Friday, March 23, 2012

Frustrating nulls with average

I have a field of values of which any can be null. I can deal with these pretty easily in all cases but the average function. I need to be able to take an average that ignores null values.
So for example if I have 5, 7, null, 5 , 7 I want the average to be 6 not 4.8.You need to count the records where {table.that_field}<>''.

Create a running total, let's say 'count_not_null':

Select field to summarize;
Type of summaries: 'count'.
Evaluate: use a formula: {table.that_field}<>''
Reset it if you need.

Then create a formula Average:

sum({table.field})/{#count_not_null}|||Thanks. I figured it would be something like that...but I just couldn't figure out the angle of attack. Works great.|||Can anyone offer a solution for the same problem except when trying to calculate median?

No comments:

Post a Comment