
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set Analysis omitting nulls
Hi,
I have a problem where I trying to filter a count() using set analysis, but it is also omitting nulls.
Imagine I have the expression
count([Vet])
this gives me a result for my dimension of 35, and
count({$<ReferralDischargeReason={'Admin Error'}>}[Vet])
gives me a result for my dimension of 1
I would assume that the expression
count({$<ReferralDischargeReason-={'Admin Error'}>}[Vet])
would give me a result of 34. It doesn't though, it give me a result of 18, because it also not counting the NULLs in the ReferralDischargeReason field, even though it counts them when I use the count with no set analysis.
Any idea why this is?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would suggest you to create flags in your script to address this issue.
If(Len(Trim(ReferralDischargeReason)) = 0, 'Null', ReferralDischargeReason) as NewReferralDischargeReason
Now use this new dimension in your set analysis, or use true flags with 0s and 1s
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could be the reason you have 16 Null values for Vet? Can you check the same
Try this, And tell us how much value return
count({$<ReferralDischargeReason={'*'}-{'Admin Error'}>}[Vet])

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Anil,
I actually have way more NULL values within 'Vet' in my table, literally thousands, and it isn't counting them when I use count([Vet]). I tried your code
count({$<ReferralDischargeReason={'*'}-{'Admin Error'}>}[Vet])
and it gave me the same result of 18.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm now checking my data more thoroughly and I can now only find 19 with Vet marked that fall within my dimension. So it looks like the original count(Vet) is wrong because I have way way way more than 16 NULL values within Vet. I'll be back.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would suggest you to create flags in your script to address this issue.
If(Len(Trim(ReferralDischargeReason)) = 0, 'Null', ReferralDischargeReason) as NewReferralDischargeReason
Now use this new dimension in your set analysis, or use true flags with 0s and 1s

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try this
count({1-<ReferralDischargeReason-={'Admin Error'}>}[Vet])
or
count({$-1<ReferralDischargeReason-={'Admin Error'}>}[Vet])

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This worked fantastic thanks. Is this just down to the way that Qlikview handles Nulls?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
More like how QlikView's set analysis handles null
