Solved

How to Average a Group Maximum Values

Posted on 2011-03-25
3
206 Views
Last Modified: 2012-05-11
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
Comment
Question by:jhardwood
  • 2
3 Comments
 
LVL 100

Accepted Solution

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

In the report header add a formula to declare the 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

by:jhardwood
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

by:mlmcc
ID: 35217328
Sorry.  Typing too fast.

mlmcc
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now