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!

Help--Calculating average

Status
Not open for further replies.

abc567

Programmer
Jul 8, 2009
45
US
Hi,
I have a grouping report which is grouped as follows
GP 1 - Date on Year
GP 2 - Date on Month

I have count of orders and want to get the average per month
i.e.,
It has data like,

2009 # of Orders
200901 15
200902 20
Avg Per Month ?

i.e., sum(# of WO)/count(# of WO)

but its not working because CR is not allowing me to do the
sum(count())

 
If you mean you want the average of the month totals for each year, then create formulas like this:

//{@reset} to be placed in GH#1 and suppressed:
whileprintingrecords;
numbervar sumwo;
if not inrepeatedgroupheader then (
sumwo := 0;
cnt := 0
);

//{@accum} to be placed in the group #2 section and suppressed:
whileprintingrecords;
numbervar cnt := cnt + 1;
numbervar sumwo := sumwo + count({table.workorder},{table.date},"monthly");

//{@display} to be placed in the GF#1:
whileprintingrecords;
numbervar sumwo;
sumwo/cnt

-LB
 

I need to calculate average of month totals for all years

For ex:
2009 - GP1
200901 - 15 (this is count of orders for group 200901 GP2)
200902 - 20 (this is count of orders for group 200902 GP2)

2010 - GP1
201001 - 30
201002 - 40


I need the average of counts at the end i.e.,
Average per month = (15+20+30+40)/4 = 26.2

Thanks lbass for replying by the way.
 
Just remove the reset formula and you will be all set.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top