Solved

Crystal Report Running Totals

Posted on 2009-05-15
4
838 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …

749 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