Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nsm1234567
Creator II
Creator II

Sum of Null equals zero - How To Resolve

Hey there,

I'm working on what should be a straightforward calculation, but I seem to be battling to get the behaviour I want.  If you look at the below, I'm doing a simple sum(NumberOfDays).  This is giving me a result of zero for Product A and Product D.  However, the Number of Days for Product D is actually null, and I want the calculation to return Null.  What is the best way to do this?  If I use a simple if statement, I have to do a sum of rows for the total, which I'd like to avoid.  Is there a straightforward way to return the result I want (app is attached).

Test1.png

2 Replies
sunny_talwar

Try this

=If(Count(NumberOfDays) > 0, Sum(NumberOfDays))


Capture.PNG

woshua5550
Creator III
Creator III

Firstly, in your case , it is actually a empty value rather then a null value , inline table can not produce null value

to prove this ,you can use "=NullCount(NumberOfDays)" , the result would be 0,

you can move your date into a Excel file which will produce null value

based on above , change your expression to like this

"=IF(NullCount(NumberOfDays)=0,Sum(NumberOfDays))"