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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
kgordis
Contributor II
Contributor II

Help with Sum and Exclude Null, It won't stop showing Zero

Hello, 

I am going a little nutty how QLikSense handles null in respect to summing. 
Simple table in Qliksense

Can someone share how to amend formula to exclude nulls?
Column 1: Sum({< [Metric Name] = {'Product Cost'}, Month = {'Jan'}> } Value)  This works
Column 2: Sum({< [Metric Name] = {'Product Cost'}, Month = {'Feb'}> } Value)  This does not work. I don't want to see zero when it is null. 

Frusterated by such a simple issue. Thanks in advance. Kevin

  Actual Actual   What QlikSense Shows

What QlikSense Shows

  Jan Feb   Jan Feb
  1 null   1 0
  5 null   5 0
  6 null   6 0
Total 12   Total 12 0

 

Labels (2)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

In the Qlik engine, the sum of NULL is zero, by definition. This makes sense, since you then have the same result summing zero rows and summing one row with a NULL.

If you want it to return NULL, you could of course use

If(Count(Value)>0,Sum(Value))

View solution in original post

3 Replies
hic
Former Employee
Former Employee

In the Qlik engine, the sum of NULL is zero, by definition. This makes sense, since you then have the same result summing zero rows and summing one row with a NULL.

If you want it to return NULL, you could of course use

If(Count(Value)>0,Sum(Value))

kgordis
Contributor II
Contributor II
Author

@hic Thank you very much. Format resolved my headache. Now I can cascade to rest of columns.

If(Count({$ < [Metric Name] = {'Product Cost'}, Month = {'Feb'}> } Value)>0,
Sum({$ < [Metric Name] = {'Product Cost'}, Month = {'Feb'}> } Value))

hic
Former Employee
Former Employee

Try an outer set expression (to simplify the expression):
{$<[Metric Name] = {'Product Cost'}, Month = {'Feb'}>} If(Count(Value)>0, Sum(Value))