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: 
Not applicable

Intersection in Set analysis

Hi Guys

I want to have the intersection values of two set expression in a straight table.

For example in the database i have CustId and Flag ( Flag values are 'Y' and 'N')

In a straight table i need CustId which are common in both the flags.

i.e. intersection of Count({<Flag = {'Y'}>}CustId) and Count({<Flag = {'Y'}>}CustId)....

Please help......................

1 Solution

Accepted Solutions
MayilVahanan

HI

Sorry, That not works

=Count({<CustID = {"=Count(Distinct Flag)=2"}>}CustID)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

7 Replies
MayilVahanan

HI

I think you want like this

=Count({<Flag = {'Y'}>*<Flag={'N'}>}CustId)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

hi Mayil

Thanks for the reply but i also used the same expression but i am not getting the result ...

can you please send me a demo application .... it will be a great help.....

MayilVahanan

HI

Sorry, That not works

=Count({<CustID = {"=Count(Distinct Flag)=2"}>}CustID)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi Mayil

thanks a lot  .. it worked .......but i have a 2 questions for you

First >>>>   Why =Count({<Flag = {'Y'}>*<Flag={'N'}>}CustId) did not worked??? because

=Count({<Flag = {'Y'}>+<Flag={'N'}>}CustId) and =Count({<Flag = {'Y'}>-<Flag={'N'}>}CustId) are working fine....................

Second>>>>>>>>>>>>>Suppose i have following  Expressions

Count( {<Status = {'Pending'},ItemType = {'A'}>}    ID)

and

Count( {<Status = {'Ready'},ItemType = {'B'}>}  ID)

now how can i get the common Count of ID............i.e. Intersection between 2 expressions

Thanks in advance.......

MayilVahanan

Hi

If custId and Flag are in different table, then '*' works, if both fields are in same table, then it not works. please check attached file..

Table1:

CustID,Flag

1,Y

1,N

2,Y

In this,

=Count({<Flag = {'Y'}>*<Flag={'N'}>}CustID)

It check the row wise, so for a custID , no possibility for have both Y and N in same row.. so its result zero..

I think you understand what am saying..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

thanks a lot for clearing my concepts......

Can you please also tell me about my second question ... how to do that ????

MayilVahanan

HI

I think, its correct method or not, but its help u

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.