Solved

Crystal Report Running Totals

Posted on 2009-05-15
4
842 Views
Last Modified: 2012-05-07
Hello,
I encountered an issue displaying Group Totals. Unfortunately my data source has duplicates of the value that I need to continually display and sum on different group footers throughout the report. I have put in a running total formula to extract a Distinct Sum. However this does not allow for a distinct sum on some groupings. Is there a way to subtract a previously display running totl value on a group from the current while printing records?
ex.
Asset #    Fueling_Count    Asset_Type
8018              7                       Crane
8018              7                       Crane
8018              7                       Crane
8019              10                     Crane
8019              10                     Crane
4548              20                     Forklift
4548              20                     Forklift
4649              9                       Forklift
4649              9                       Forklift
 &&

I need the footer to display like below

Asset Type                  Fuelings
Crane                               17
Forklift                              12
 ................................................
    Totals                           29

Instead I get

Asset Type                  Fuellings
Crane                               17
Forklift                              29
 ................................................
    Totals                           29

Any help would be appreciated, I'm using Crystal 11 and am unable to modify the table that I am extracting the data from.
0
Comment
Question by:cs486
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 24397912
There is no way to do that.

However you can use a second running total
Use the current one for the group total
Add a new one which is the same except have it reset on AssetType change
Group by AssetType if you aren't
Display the total in the AssetType group footer
Reset the total on change of the group AssetType

mlmcc
0
 

Author Comment

by:cs486
ID: 24398576
I believe i have tried whae you have stated but could not get the reset to work properly. Below is the Running Total that i am running and i am grouped on {%t_object_type_category} (Asset Type from my example above).

If you could assit in the proper way to reset the second Running Total on the Group Change. I have removed the  {EQUIP_MAINT_COST\\.OBJECT_CODE}  for my second RT but that only displays the last total for the last object for the Asset Type grouping which could be 3-15 objects.

Running total 1
//Report Header
WhilePrintingRecords;
numbervar RunT:=0;
numbervar DupT:=0;
numbervar Total2:=0;

//Report Detail
WhilePrintingRecords;
numbervar RunT;
numbervar DupT;
numbervar Total2;

RunT:= RunT + {EQUIP_MAINT_COST\\.TOTAL_FUELING};
if NOT OnLastRecord AND next({EQUIP_MAINT_COST\\.COMPANY}) = {EQUIP_MAINT_COST\\.COMPANY}
and Next({%t_object_type_category}) = {%t_object_type_category}
and Next ({EQUIP_MAINT_COST\\.CONTRACT}) = {EQUIP_MAINT_COST\\.CONTRACT}
and next ({%t_object_model_year})={%t_object_model_year}
and next ({EQUIP_MAINT_COST\\.OBJECT_CODE}) = {EQUIP_MAINT_COST\\.OBJECT_CODE} then
DupT:= DupT + {EQUIP_MAINT_COST\\.TOTAL_FUELING};
Total2:= RunT - DupT

//Report Footer
WhilePrintingRecords;
numbervar Total2;
Total2

cs486
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 24398848
That is a manual running total.  I thought you were using the running total fields.

In the group header where you want the value reset (Change to the correct variable)
WhilePrintingRecords;
numbervar RunT;
RunT := 0;
''

mlmcc
0
 

Author Comment

by:cs486
ID: 24399015
Sorry for the confusion on that, but works like a charm now

Thank you
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question