Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jlampard40
Contributor III
Contributor III

Straight table average using columns excluding zeros

Hi - I have a straight table, with 8 columns.  I'd like to work out the average of these 8 columns but excluding zeros as this will skew the count.

This works well, but gives me skewed average due to the zeros within columns:

(Column(1)+Column(2)+Column(3)+Column(4)+Column(5)+Column(6)+Column(7)+Column(8))/8

Thanks guys.

2 Replies
prabhuappu
Creator II
Creator II

Obviously you can use if conditions. But if you need a solution without if condition then use the below expression. This might solve your problem. 

(Column(1)+Column(2)+Column(3)+Column(4)+Column(5)+Column(6)+Column(7)+Column(8))

/

(-1*( (column(1)>0) + (column(2)>0) + (column(3)>0) + (column(4)>0) + (column(5)>0) + (column(6)>0) + (column(7)>0) + (column(8)>0) ))

Brett_Bleess
Former Employee
Former Employee

I would believe you are likely going to have to use Set Analysis in that case to accomplish things:

https://community.qlik.com/t5/Qlik-Design-Blog/Excluding-values-in-Set-Analysis/ba-p/1471704

That post may get you on the right track, here is the base Design Blog URL in case you want to search for other related posts there:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.