Solved

Getting an Average from a group summary formula

Posted on 2012-04-05
6
280 Views
Last Modified: 2012-08-13
I have a report that is grouped by Department which lists employee production metrics and hours worked.  I use a simple formula to generate their work output, known as Lines Per Hour, which is essentially Lines/Hour just as it reads.  For the Department footer I have a subtotal which has the Lines/Hour for the department and use a similar formula to reach that number.  I would like to also generate an Average Lines/Hour but I am unable to summarize a summary field due to the way Crystal processes the report.

I understand there is some sort of two pass system to crunching formulas in Crystal but never having dealt with the "second pass" I'm a little unsure how to proceed with doing this.  Any help would be appreciated.

Thanks,
SPAR
0
Comment
Question by:StrawsPulledAtRandom
[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
6 Comments
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 250 total points
ID: 37814702
It isn't the two-pass method just that summarizing a summary in most cases doesn't make sense

You can use the same formula in the report footer.
If that doesn't give what you want then try this

In the report header add a formula
DeclareVariables
WhilePrintingRecords;
Global NumberVar intCount;
Global NumberVar totalAvgLinesPerHour;
""

In the group footer add a formula
CalcTotal
WhilePrintingRecords;
Global NumberVar intCount;
Global NumberVar totalAvgLinesPerHour;
intCount := intCount + 1;
totalAvgLinesPerHour := totalAvgLinesPerHour + {YourAverageFormula};
""

In the report footer
DispAverage
WhilePrintingRecords;
Global NumberVar intCount;
Global NumberVar totalAvgLinesPerHour;
If intCount = 0 then
      0
Else
     totalAvgLinesPerHour / intCount

mlmcc
0
 

Author Comment

by:StrawsPulledAtRandom
ID: 37816146
This works for a grand total but it seems to just give me a running total for the group totals which is where i need to average.  The grand total average isn't really relative to this situation as each dept. is completely different sets of work.  I'm looking to find the departmental average as a sort of rough guideline for what the department does on a daily basis.

Basically the report works like this:

Report Header - Title, etc
Group 1 Headers - suppressed
Details - suppressed
Group 1 Footer - Displays grouped department totals, need the average lines per hour to appear here
Report Footer - Grand totals for relevant things like orders, lines, packages, etc

Thanks for your help thus far!
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37818168
SOrry I misunderstood what you wanted.

If you could do it, what is the formula for the average you need?

mlmcc
0
 
LVL 35

Accepted Solution

by:
James0628 earned 250 total points
ID: 37818422
> I use a simple formula to generate their work output, known as
 > Lines Per Hour, which is essentially Lines/Hour just as it reads.

 Does that formula use summaries, or just detail fields?

 If it uses detail fields, it seems like you could just do an average on that.

 If it uses summaries, then maybe you can get what you want with some changes to mlmcc's suggestion.  I'm doing some guessing here, so this is something of a shot in the dark.

 Keep the first formula (DeclareVariables) in the report header.

 Create a new formula like the following (call it whatever you like) and put it in the group header, to reset the variables for each new group (department):

WhilePrintingRecords;
Global NumberVar intCount;
Global NumberVar totalAvgLinesPerHour;
intCount := 0;
totalAvgLinesPerHour := 0;
""


 Move the second formula (CalcTotal) from the group footer to the detail section.  Replace {YourAverageFormula} with your "Lines Per Hour" formula.

 Move the final formula (DispAverage) from the report footer to the group footer.


 With a bit of luck, maybe that will give you what you want.  Otherwise, we'll probably need to know more about your "Lines Per Hour" formula, and exactly what you need from that.

 James
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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