Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum() behaviour with null values

Hi all!

Why is it that Sum() returns 0 if the value in that row is actually NULL?

This is (at least) a bit annoying if not wrong in some cases.

For example:

YearAccidents
20141
20155
2016-

Sum(Accidents)  for all three Years returns 6 which is correct.

If a User selects year 2016 only, QV will return 0 which is totally incorrect. Its like QV knows, that it will be 0 in all 2016?!

It rather should return NULL...

Does anyone know how to treat this right?

-phil

12 Replies
sunny_talwar

You can try this, but not sure how much performance benefit you will get:

Sum({<Year = {"=Sum(Accidents) <> 0"}>}Accidents)

Anonymous
Not applicable
Author

Hi Sunny,

sorry, it also shows "0" instead of "-"

sunny_talwar

You are right. Not sure another way of doing this, except doing this with an if statement