Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Thomas_Qlik
Contributor II
Contributor II

Operators in set analysis

I am trying to get the count of KTOKK which do NOT have in field FAUSF the value "+". (FAUSF has a number of potential values, e.g. "*", "-", "+")

 

Can somebody please tell me what is the difference between the 2 below statements? (Only difference is the position of the "-")

count(distinct{<FAUSF-={'+'}>}[KTOKK])

count(distinct{-<FAUSF ={'+'}>}[KTOKK])

It appears the first statement is working properly, but I would appreciate if somebody could confirm that and also briefly tell me what logically is happening in the 2nd statement and why it does not deliver what I expect.

 

Many thanks,

Thomas

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

count(distinct{<FAUSF-={'+'}>}[KTOKK])

Should be Count KTOKK for all values of FAUSF except '+' (Note: Null is not a value, so if FAUSF is null, KTOKK will not be counted)

count(distinct{{$}-<FAUSF ={'+'}>}[KTOKK])

Should be Count KTOKK for all selected values, except when FAUSF is '+' (Note: This will count KTOKK for cases where FAUSF is null)

View solution in original post

4 Replies
Or
MVP
MVP

count(distinct{<FAUSF-={'+'}>}[KTOKK])

Should be Count KTOKK for all values of FAUSF except '+' (Note: Null is not a value, so if FAUSF is null, KTOKK will not be counted)

count(distinct{{$}-<FAUSF ={'+'}>}[KTOKK])

Should be Count KTOKK for all selected values, except when FAUSF is '+' (Note: This will count KTOKK for cases where FAUSF is null)

Thomas_Qlik
Contributor II
Contributor II
Author

Thanks for the explanation. It starts to get a bit clearer, but I am not yet fully understanding what is happening here. Potentially, I am misunderstanding your explanations.

I was under the impression that if no identifier is selected, then "$" is used as default.

This seems to be the case for the second statement, where -as expected- the selected values are used (identifier "$"). In the first statement, however, based on your explanation, it seems that all values are used.  How does this come? Would I not have to specifically use identifier {1} to get such a behavior?

What is the concept/reason, why in one statement NULL values are counted, wheras in the other, they are not counted?

Or
MVP
MVP

If I'm not mistaken, {$} - is the same as just having the minus sign (which you originally did), since {$} would be implicit. I find the version I used to be easier to read, though, so I always use the explicit {$} if I'm doing "Subtract a subset from the current selections".

When you use Fieldname = {"SomeValue"}, you are essentially telling Qlik to make a subset of all FieldName values (possible or otherwise) and then apply that set. If you do not state otherwise, this set will be applied to the current selections (and dimensions if within an object), but it's still a list of the values, and null is not a value. This should not be the same as removing Fieldname = SomeValue from the current state, because the latter would not exclude nulls. 

I'm not sure if that's entirely the right explanation, but that's how I understand it.

Thomas_Qlik
Contributor II
Contributor II
Author

Many thanks for the detailed explanation. Much appreciated!