Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining Percentages of Averages 1

Status
Not open for further replies.

putts

Programmer
Dec 13, 2002
93
US
Each record in my report has a start and stop date which represent when the record was processed.

There are two groupings in the report.

For each grouping, I need to see how long each record took to process and then figure out the average.

Once I get that average, I want to see what percent of the records fell below the average and what percent were above (to see if there are any records that are extremes and might yield misguiding averages)

What I'm doing right now is for each record (in the Details which are supressed) I'm calculating the number of days it took to process that record.
Then, in each group footer, I calculate the average of those numbers.

What I need is how to now, after figuring out the average, figure out how many records were below the average and how many were above.

How do I do this?

TIA.
 
Create two running totals using the running total editor. For running total {#diff>ave}, select your difference field {@diff} and count as the summary, evaluate based on a formula:

{diff} > sum({@diff},{yourgroup1})/count({@diff},{yourgroup1})

Reset on change of Group1. Repeat this and reverse the sign to get the count of those with a difference less than the average. You can repeat the two formulas for your other group also, substituting Group 2 for all group references.

The running totals must be displayed in the corresponding group footers. You can use the running totals in formulas to determine percentages, too, as in:

{#diff>ave}%count({@diff},{yourgroup1}

-LB
 
Does the running total get computed all at once before everything else?

Cuz, if it doesn't, then you're just comparing the current value to average of just the previous values up to that point.

I thought of this option, but thought, because of this, it wouldn't work.

 
No, the running total is computed after--and appropriately so--it is comparing the value for each difference with the average of the differences across all the rows. The running total is counting the number of differences that are above (or below the average, in the case of the second running total)--it is NOT calculating the average.

I tested this, and it does work, so why not give it a try? Please let me know if your results are not what you'd expect.

-LB
 
I'm a bit confused with what the field {diff} is in your example.

Is that a running count or a sum or something?

Also, just to clarify exactly what I'm looking for, here's an example:

If I have 5 records and each of the first four process in 1 day and the fifth takes 36 days to process, then the average processing time on those 5 records is 8 days (40/5).

Now, what I need to do is say that each record that took 1 day to process is less than that average and only the fifth is over, therefore, my percentage under the average is 80% (4 out of 5 under) and the percent over the average is 20%.

There's more of an actual example of what I'm doing.
 
I left out the formula tag @ on one of the items above--sorry. I was assuming you had a formula which I called {@diff} which calculated the processing time for each record like this:

{@diff} = {yourstopdate}-{yourstartdate}

Your description of what you were looking for is what I thought you meant, and my earlier suggestion should work, although here is the corrected formula for the running total:

{@diff} > sum({@diff},{yourgroup1})/count({@diff},{yourgroup1})

-LB


 
Okay, got it now.

Thanks for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top