Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want a function to calculate average, but only when the value is <> 0.
Numbers: 100, 0, 200
AVG(Number): 100 (100+0+200 / 3)
I want 100+200 / 2 = 150
Thank in advance!
Hi,
Use a set to exclude zero:
=Avg({< F1 -= {0}>} F1)
Stephen
Use Set Analysis:
Avg({<Numbers = {'>0'}>} Numbers)
EDIT: Didn't see Stephen's reply when I posted. His will work for you.
sum(Number) / count( if(Number>0,Number))
JJ
Thanks for the question, it inspired a blog post:
http://qliktips.blogspot.com/2010/01/more-on-sets-or.html
BTW to the other guys - your ">0" set implies that all the numbers will be positive.
Stephen