Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sum in Two Groups Post Reply Post New Topic
Author Message
elie234
Groupie
Groupie


Joined: 21 Aug 2009
Online Status: Offline
Posts: 68
Quote elie234 Replybullet Topic: Sum in Two Groups
     Posted: 26 Aug 2009 at 1:51pm
I have a report that involves 2 groups, a department (Group #1) and sub-department (Group #2). I have a sum for each subdepartment and I then went to get a sum for all of those sums which is the sum for the entire department. I would like to put this sum in the Group #1 footer. But CR in either running total or formula says the sum field in Group #2 can't be summarized. Is there a way around this?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Aug 2009 at 2:27pm
Is this conditionally summing rows or is it a sum of all the rows?
If condtional please explain the row level data and the conditions, if it is for all just use the Summary function at group level 1 and group level 2.
Click on the field to SUM to activate it.
Click on the Insert Summary button (Sigma)
Field should already be the correct one but change it if you need to.
Make the calculate as a SUM
Change the location as Group 1.
It will dropr the field on your group footer1.
 
Do the exact same thing as but make the change loaction group 2.
It will drop the field on the group footer2
 
 
As an FYI shortcut...
If you have already create a Summary field using the insert summary option at one group level you can make a copy of that field (ctrl +c) and paste it (ctrl +v) onto the another group level and the pasted one will adjust itself to summing at that level without changing the original...
or if you make one at the wrong group level just drag and drop it on the correct level and it will adjust itself.
These summaries can be used in HEaders or footers whereas RTs can not be used in headers.


Edited by DBlank - 26 Aug 2009 at 2:36pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Aug 2009 at 2:42pm
As I review you other post from today I assume this is a follow up on that and is a conditional sum.
If you went with the Running Total suggestion create another RT the exact same way as before to get your values per group 2 with your condition to include the record but instead of reseting at the Group2 (and displaying on GF2) reset this RT at Group level 1 (and display on GF1).
 
If you used a variable you will need to create new variable formuals that do the same summing process as the ones you are using for GF2 but your reset variable formula will be set on GroupHeader1 and your fianl value will be placed on GF1.


Edited by DBlank - 26 Aug 2009 at 2:44pm
IP IP Logged
elie234
Groupie
Groupie


Joined: 21 Aug 2009
Online Status: Offline
Posts: 68
Quote elie234 Replybullet Posted: 26 Aug 2009 at 2:45pm
The sum for Group #2 is a conditional sum. If the subdepartment is in department (Group 1) X it runs a certain calculation and if it is in department Y it runs another. I would think I should just be able to run the same formulas on the Group 1 level, but when I do that I am getting a larger number than the sum of Group 2.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Aug 2009 at 2:50pm

It depends on how you set it up. Did you create 2 different formulas or did you make it one longer one with both conditions?



Edited by DBlank - 26 Aug 2009 at 2:50pm
IP IP Logged
elie234
Groupie
Groupie


Joined: 21 Aug 2009
Online Status: Offline
Posts: 68
Quote elie234 Replybullet Posted: 26 Aug 2009 at 2:51pm
Sorry replied previously before I got your second reply. It is one long formula, I rewrote it per your suggestion. Got it! Thank you very much.
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