Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis best practice

What exactly is the difference between using the - sign as a set operator in a set analysis and using -= as a set identifier.

For example, what is the difference between these two expressions?

COUNT(DISTINCT {$<TestAccount={'false'},UserName-={'*test*'},Firm-={'*TEST*'}>}SessionId)

and

COUNT(DISTINCT {$<TestAccount={'false'}>-<UserName={'*test*'},Firm={'*TEST*'}>}SessionId)

Please don't copy and paste help text from the application as it is not hugely helpful. If anyone could explain it in plain english, that would be be great!

thanks very much

Alex

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Hi Alex,

    You have to be careful interchanging the two. I have attached a difference in your example depending on the kind of data you might have. The counts can be different. Here is an image explaining what happens (also attached the qvw):

SetAnalysisImage.PNG.png

Hope this helps!

View solution in original post

6 Replies
anbu1984
Master III
Master III

UserName-={'*test*'}  - Select Count(Distinct SessionId) from table where TestAccount='false' and UserName Not Like '*test*'


TestAccount={'false'}>-<UserName={'*test*'}

Select Count(Distinct SessionId) from (

Select SessionId from table where TestAccount='false'

Minus

Select SessionId from table where UserName like '*test*' )


Not applicable
Author

Both expressions will count distinct sessionIDs with TestAccount = False,

The first will exclude Usernames like TEST and Firm like TEST.

The second expression in also counting distinct TestAccounts that are false, but will include Username like Test and Frim like TEST. 

Not applicable
Author

Hi Alex,

I would take a look at this thread maybe, will give you a good overview of what the signage is doing

http://community.qlik.com/docs/DOC-4951

hope that helps

Joe

ashfaq_haseeb
Champion III
Champion III

Hi,

Check this.

Romancing with Set Analysis

regards

ASHFAQ

jerem1234
Specialist II
Specialist II

Hi Alex,

    You have to be careful interchanging the two. I have attached a difference in your example depending on the kind of data you might have. The counts can be different. Here is an image explaining what happens (also attached the qvw):

SetAnalysisImage.PNG.png

Hope this helps!

Not applicable
Author

Thanks Jeremiah. That was very clearly explained. Exactly what i was looking for!

I had overlooked the fact that the expression below meant AND and not OR

<UserName={'*test*'},Firm={'*TEST*'}>