• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 853
  • Last Modified:

Crystal Report Running Totals

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
cs486
Asked:
cs486
  • 2
  • 2
1 Solution
 
mlmccCommented:
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
 
cs486Author Commented:
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
 
mlmccCommented:
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
 
cs486Author Commented:
Sorry for the confusion on that, but works like a charm now

Thank you
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now