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!

Average of non zero values 1

Status
Not open for further replies.

RichGK

IS-IT--Management
May 10, 2004
7
GB
I need to create an average of the values returned that are not equal to zero.

Can anyone help please?
 
You'll have to use a formula to create the number to divide by and another formula to do your average.

The first formula will look something like this (I'll call it {@NonZero}:

If IsNull({table.value}) or {table.value} = 0 the 0 else 1

The second will look something like this:

if sum({@NonZero}) > 0 then
sum({table.value})/sum({@NonZero})
else 0

This does the average for the report as a whole. If you need to do it for a group, you'll format the sums like this:

sum(value, group field)

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top