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: 
SonPhanHumanIT
Contributor III
Contributor III

Set Analysis Null Values

Hello Qlik experts,

I have a question regarding Set Analysis. I know it might be possible to handle this more elegantly in the backend, but I still want to improve my Set Analysis skills.

Here's my scenario: I want to exclude certain values from a field, but I also want to include the null values. How can I structure the following query correctly without filling the null values with a specific value in the data editor?

I have tried: COUNT({<BelegArt={'U'}, Herk_BelegArt-={'A'}>}ID), but this doesnt work.

SonPhanHumanIT_0-1705507704536.png

 

LOAD ID, 
BelegArt,
If(LEN(Herk_BelegArt) = 0, NULL(), Herk_BelegArt) AS Herk_BelegArt
    
    
    
    Inline [
ID, BelegArt, Herk_BelegArt
1, U, A
2, A,
3, G,
4, U,
5, U,    VSA
 
 
 
];

 

 

Best regards Son

 

Labels (1)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

NULLs are not selectable, so you cannot use them in a set expresion.

But you can try using the E() function to select the right IDs, something like

Count({<BelegArt={'U'},ID=E({<Herk_BelegArt={'A'}>} ID)>} ID)

See also https://community.qlik.com/t5/Design/Excluding-values-in-Set-Analysis/ba-p/1471704.

View solution in original post

3 Replies
MK_QSL
MVP
MVP

NULLCOUNT({<BelegArt = {'U'}>}Herk_BelegArt) + COUNT({<BelegArt={'U'}, Herk_BelegArt-={'A'}>}ID)

hic
Former Employee
Former Employee

NULLs are not selectable, so you cannot use them in a set expresion.

But you can try using the E() function to select the right IDs, something like

Count({<BelegArt={'U'},ID=E({<Herk_BelegArt={'A'}>} ID)>} ID)

See also https://community.qlik.com/t5/Design/Excluding-values-in-Set-Analysis/ba-p/1471704.

SonPhanHumanIT
Contributor III
Contributor III
Author

Thank you for your input. This solution is almost perfect, but in my opinion, HIC's solution is more elegant.