Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sum balance of only LAST detail for each group Post Reply Post New Topic
Author Message
WillieK
Newbie
Newbie
Avatar

Joined: 29 Jun 2009
Location: South Africa
Online Status: Offline
Posts: 8
Quote WillieK Replybullet Topic: Sum balance of only LAST detail for each group
     Posted: 29 Jun 2009 at 12:42am
Hi there,
 
I have designed a report with two groups and then multiple detail lines.  The detail lines reports on data which includes amounts for items with their depreciation.
I need to tally the total value of all the items reported on, after their depreciation, which means that only the LAST detail line balance should be summed.  I can get a running total which gives me the sum of the FIRST detail for each group...  How do I tell it to sum the balance of each LAST detail line for each group?
 
Please let me know should you require more information.
 
Any help would be appreciated.
 
Thank you!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 29 Jun 2009 at 7:01am
write a formula that increments a variable ( I like shared ) and place the formula in the group footer, this will only read the last record displayed in the detail.  Then when you want to display your variable, write a formula to display and place it in the section desired.
 
If this value ever needs to be reset, write a formula to set it to 0 and place in the (usually) group header of where it is displayed
 
HTH
 
IP IP Logged
WillieK
Newbie
Newbie
Avatar

Joined: 29 Jun 2009
Location: South Africa
Online Status: Offline
Posts: 8
Quote WillieK Replybullet Posted: 29 Jun 2009 at 11:16pm
Thanx for the reply and the suggestion.
I am new to Crystal so I'm not familiar with how to do this, but I appreciate you pointing me in the right direction.
I will give it a try and if I cannot get it right, I will post a response again.
IP IP Logged
WillieK
Newbie
Newbie
Avatar

Joined: 29 Jun 2009
Location: South Africa
Online Status: Offline
Posts: 8
Quote WillieK Replybullet Posted: 30 Jun 2009 at 6:59am
I got this working using 4 formulas.
1: on the detail line iself.  In this I increment 2 shared variables with the value of the item, once the item number is different from the Next(ItemNumber). (One for the group total and one for the grand total)
2: on the group footer.  This increments the 2 shared variables if the NextIsNull(ItemNumber), since the previous won't take into account the last record.
3: on the report footer.  This simply displays the grand total.
4: on the group footer again.  In this I simply set the group total to 0 when the GroupNumber is not equal to Next(GroupNumber).
 
I don't know if this is the best way of doing it, but it's the only way I could seem to get it to work...
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