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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Average total and average in group

Status
Not open for further replies.

mdr

MIS
May 14, 2003
17
0
0
GB
I would like some help with averages. I have a total average response time, which is sum of response time / number of tasks.

however, can i group in an average? what i would like to see is something like this:

average reponse top grouping = 15 hours

average reponse middle grouping = 3 hours

average reponse lowest grouping = 6 hours


Is it to do with the groupings, or the way that i create my functions?

Any help would be appreciated.
 
You can't group on summary fields, but here's a different approach. I assume you have a group on whatever field you are averaging your response times over--let's call it {staff.ID}. First, go to report->topN and choose "All" and select your average response time field for the topN sort. Then create a running total {#cntgrps} which counts your {staff.ID} groups: Select {staff.ID}, distinctcount, evaluate for each record, reset never. Place this in the group (staff) footer field.

Then create a formula like the following:

whileprintingrecords;
numbervar top;
numbervar avetop;
numbervar mid;
numbervar avemid;
numbervar bot;
numbervar avebot;
numbervar i := distinctcount({staff.ID});

if {#cntgrps} in 1 to i/3 then
top := top + average({table.resptime}, {staff.ID}) else
top := top;
avetop := top/(i/3);

if {#cntgrps} in (i/3)+1 to (2*i)/3 then
mid := mid + average({table.resptime}, {staff.ID}) else
mid := mid;
avemid := mid/(i/3);

if {#cntgrps} in ((2*i)/3)+1 to i then
bot := bot + average({table.resptime}, {staff.ID}) else
bot := bot;
avebot := bot/(i/3);

Now you can display each of these in the report footer by creating formulas like:

whileprintingrecords;
numbervar avetop;

Repeat for avemid and avebot.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top