Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

danimelo1
New Contributor III

Help on set analysis Qlik Sense

Hi experts,

Giving this table:

data.jpg

I need to show only person id, who have a action different of  U5 with the folowing list of Action Reason reason: U2, Z1.

So in this case, it should exclude Person ID: 3048, 6037, 8311, 11530.


I'm trying this but it doesn`t work:

=if([Action]='U5'] and [Action Reason]<>'U2' or [Action Reason]<>'Z1',[Person ID])

What am I missing?

Regards,

Daniel M

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Help on set analysis Qlik Sense

Try this

=If([Action] = 'U5' and Match([Action Reason], 'U2', 'Z1'), [Person ID])

5 Replies
Ivan_Bozov
Valued Contributor

Re: Help on set analysis Qlik Sense

Hi, try this:

Only({<Action-={'U5'}, [Action Reason]={'U2','Z1'}>}PersonID)

danimelo1
New Contributor III

Re: Help on set analysis Qlik Sense

It gives me an error of Invalid dimension. I'm trying to present it in a straight table

Ivan_Bozov
Valued Contributor

Re: Help on set analysis Qlik Sense

This is a measure.

Edit: I have misread your requirement. So you are trying to exclude the combinations U5+Z1 and U5+U2?

Create the following line in the script.

IF(Action='U5' AND MATCH([Action Reason],'Z1','U2'), 'Exclude','Include') AS Flag

Then your script will look something like this:

Load

    PersonID,

    Action,

    [Action Reason],

    IF(Action='U5' AND MATCH([Action Reason],'Z1','U2'), 'Exclude','Include') AS Flag

Inline [

PersonID,Action,Action Reason

3048,U5,Z1

4433,U9,U2

11530,U5,U2

11135,U5,U1

]

(Delimiter is ',')

In the table use the following measure:

Only({<Flag={'Include'}>}PersonID)

Capture.PNG

MVP
MVP

Re: Help on set analysis Qlik Sense

Try this

=If([Action] = 'U5' and Match([Action Reason], 'U2', 'Z1'), [Person ID])

danimelo1
New Contributor III

Re: Help on set analysis Qlik Sense

Genius!!

Thank you Sunny, I was expecting if you some day replied this answer.  You Rocks!