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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
JuMo
Creator
Creator

Handling Null Values in GroupBy Sum Operations

Hello

I have three fields that may sometimes contain null values. When I perform a group by operation in my script with 'Sum(NumberSumX)', the result returns 0 even when the values are null. I want the sum of null values to be null as well.

 

Here's my current script:

 

Load

   Dimension,

   Sum(Number1) as NumberSum1,

   Sum(Number2) as NumberSum2,

   Sum(Number3) as NumberSum3

From ...

Group By Dimension;

 

I've seen solutions using a where statement, but they seem to only work with a single field. I'm having trouble adapting it to work with multiple fields. In my case, any of the NumberX fields can be null while the others are not.

How can I modify my script to achieve the desired result?

Labels (2)
10 Replies
JuMo
Creator
Creator
Author

Clean an elegant as usual !

Many thanks to everybody in this thread