Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Group and sum of 2 columns Post Reply Post New Topic
Author Message
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Topic: Group and sum of 2 columns
     Posted: 26 Aug 2010 at 5:01pm
Hi,
 
I need to group one column based on a condition (specific value) and then summarise the value of another column corresponding to this condition.
 
Example:
 
Column 1             Column 2
898                       hours
125.79                  units
3.00                      units
3.00                      hours
 
I want to group on column 2 and sum on column 1 to get:
 
 
Column 1             Column 2
901                       hours
128.79                  units
 
 
I have tried to enter the following code but get an error saying 'there must be a group that matched this field'
 
 
Sum ({@hrs & units joined},{@hrs or unit label} )
 
 
where
column 1 = {@hrs & units joined} and
column 2 ={@hrs or unit label}
 
 
i would appreciate any assistance
 
Regards,
DespinaCry
 
IP IP Logged
sukhveer
Newbie
Newbie


Joined: 18 Aug 2010
Online Status: Offline
Posts: 22
Quote sukhveer Replybullet Posted: 26 Aug 2010 at 7:01pm
step 1: insert a group and group by 'column2'
step 2: place your 'column1' in the detail section
step3: insert a summary-> field to summarize is 'column1' -> calculate Sum -> summary location: select the grouping of 'column1'
step4: place your 'column2' in the group footer section (where you have your summary field)
step5: suppress the group header section and the detail section
step6: run the report and enjoy!


Edited by sukhveer - 26 Aug 2010 at 7:02pm
IP IP Logged
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Posted: 29 Aug 2010 at 1:44pm
Hi
 
I have been adding my grouings and totals through scripting.  So easy to apply your method - thankyou so much
 
Regards,
Despina
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum