Solved

# How to Average a Group Maximum Values

Posted on 2011-03-25
208 Views
I have a report that is grouped on a LoadID field (multiple rows per LoadID, each row containing a Mileage field).  For each LoadID group, I use a running total to display the maximum Mileage for that LoadID.

Now, in the footer of the report, I want to put in the average of these Maximum values (i.e. average the maximum Mileage for each LoadID). I can't use a running total or a summary field on the running total field that I used to display the maximum mileage per load, as per Crystal capabilities.

Any suggestions/questions?
0
Question by:jhardwood
• 2

LVL 100

Accepted Solution

mlmcc earned 500 total points
ID: 35215388
You will need to use a manual average using formulas and variables.

WhilePrintingRecords;
Global NumberVar RecCount;
Global NumberVar MileageTotal;
""

In the group footer add a formula to calculate the total
WhilePrintingRecords;
Global NumberVar RecCount;
Global NumberVar MileageTotal;
RecCount := RecCount + 1;
MileageTotal := {&MaxRunningTotal};
""

In the report footer add a formula to calculate and display the average
WhilePrintingRecords;
Global NumberVar RecCount;
Global NumberVar MileageTotal;
If RecCount > 0 then
MileageTotal / RecCount
Else
0

mlmcc
0

Author Comment

ID: 35217249
Excellent!  Worked Great!  I id have to change the MileageTotal calculation in the group footer formula to

MileageTotal := MileageTotal + {&MaxRunningTotal}

Without that change, the MileageTotal was alwas equal to the value of the last row.

Thanks again!
0

LVL 100

Expert Comment

ID: 35217328
Sorry.  Typing too fast.

mlmcc
0

## Featured Post

Question has a verified solution.

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