Question

How to count average WITH zeros in LookML?

  • 22 September 2022
  • 3 replies
  • 32 views

Hello! I didn’t find anything like this in other topics, but I really need to count average with zeros. 

F.ex. I have numbers 22, 22, 0, 44, 0. Type of measure “average” usually ignores zeros and basically counts 88/3. But what I need to do, it’s 88/5. I need to do this in LookML. Any ideas, please?


3 replies

Userlevel 2

I think the average measure will already do what you want, i.e. include the zeros and do 88 / 5.

(If it was 22, 22, NULL, 44, NULL the NULLs would be ignored and hence 88 / 3.)

I think the average measure will already do what you want, i.e. include the zeros and do 88 / 5.

(If it was 22, 22, NULL, 44, NULL the NULLs would be ignored and hence 88 / 3.)

Yes, you are right. I noticed that all my other views counts zeros, but not this one, and that’s why I have this issue. And I have no idea why

Userlevel 7
Badge +1

Have a look at the generated SQL perhaps you have value formatting applied but the actual data is NULL

Reply