Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Average a Group Maximum Values

Posted on 2011-03-25
3
Medium Priority
?
213 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
[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
3 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 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 101

Expert Comment

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

mlmcc
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

721 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