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

incorrect averages

Status
Not open for further replies.

yehong

Programmer
Sep 22, 2003
291
0
0
US
I have a running total on a field, say Field1 that calculates average. I am using Average function in the running total. The problem is average is coming up incorrect. Say there are 4 records and if only three records have the values, then Avg should be Sum(Field)/3, but the function is doing like Sum(Field)/4. I tried using Weighted Average and still getting incorrect values. Any idea? I can do it by creating two different running totals and then doing division in a formula. But I was wondering if I could do same in one running total.
 
If you have 4 rows, then you DO have a value, it just might happen to be zero or null but you consider that incorrect, to many it would be correct.

You can eliminate those rows which you don't want included if you'd like using Report->Edit Selection Formula:

(
isnull({table.field})
or
{table.field = 0
)

Otehrwise I'd roll my own as you suggested.

-k
 
I had a similar problem recently and corrected it by adding the following to the running total's formula.

If {@the formula returning the value you want to average}>0 then true

This cleared things up very nicely for me.

James
 
Hi James, After posting this post, yesterday this same idea came in my mind and I did exactly same thing like you did and it worked perfectly. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top