Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problems with AVG (Skip values=0)

Hi.


I have in my database a numeric column, but I need to make avg without taking into account records with value 0.


I'm showing the avg result  in a text object , but It takes into count the values ​=0 and the result varies greatly from what I expect.




My expression in the text object is:


1.JPG


And my BD is:


2.JPG


thanks for your help.




1 Solution

Accepted Solutions
swuehl
MVP
MVP

Or (assuming you want to consider user selections) use the intersection operator *

=Avg({<PREGUNTA615_24 *= {">0"}>} PREGUNTA615_24)

or

=Avg({<PREGUNTA615_24 -= {0.00}>} PREGUNTA615_24)


or not using set analysis


=Avg( If(PREGUNTA615_24 <> 0, PREGUNTA615_24))

View solution in original post

4 Replies
sunny_talwar

Try this:

Avg({<PREGUNTA615_24 = {'>0'}>}PREGUNTA615_24)

swuehl
MVP
MVP

Or (assuming you want to consider user selections) use the intersection operator *

=Avg({<PREGUNTA615_24 *= {">0"}>} PREGUNTA615_24)

or

=Avg({<PREGUNTA615_24 -= {0.00}>} PREGUNTA615_24)


or not using set analysis


=Avg( If(PREGUNTA615_24 <> 0, PREGUNTA615_24))

sunny_talwar

sunny_talwar

And once again.

Man I have to be more descriptive in my responses and cover all possibilities. I am getting there