Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 |
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))
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))
@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))
Try an outer set expression (to simplify the expression):
{$<[Metric Name] = {'Product Cost'}, Month = {'Feb'}>} If(Count(Value)>0, Sum(Value))