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: 
JustinDallas
Specialist III
Specialist III

Show Zero in Table for Sum

Hello Everyone,

I have a table where I would like every dimension to have a '0' when it doesn't meet the Set Analysis requirement.  For instance, I have this dataset.

TestData:

LOAD * Inline

[

'UserId', 'ProductType','Count'

    1, 'Cookies', 3

    1, 'Biscuits', 4

    2, 'Peas', 5

    2, 'Sugar', 6

]

;

EXIT Script

;

Then, I have a table showing the UserId and a Set Analysis value of 'SUM({<[ProductType]={'Peas'}>} Count)'.  When a UserId doesn't have any Peas, the table throws the row away, giving me this.

Capture3.PNG

What I would like is something like this.

Capture4.PNG

And of course, I've got that 'Include Zero Values' checked (but this isn't quite a zero value, it's more like some kind of Null).

Capture5.PNG

Any help is greatly appreciated.

1 Solution

Accepted Solutions
sunny_talwar

May be try this

Sum({<[ProductType]={'Peas'}>} Count) + Sum({1} 0)

View solution in original post

4 Replies
sunny_talwar

May be try this

Sum({<[ProductType]={'Peas'}>} Count) + Sum({1} 0)

sunny_talwar

Capture.PNG

JustinDallas
Specialist III
Specialist III
Author

Ha!  That's it!  Thanks, I spent all night battling this problem to no avail.

Jorge_Iturra
Partner - Contributor II
Partner - Contributor II

Hey, this work on qlik cloud as well ! 

 

Thank you very much.