Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
prutis66
Contributor III
Contributor III

Set Intersection

Hi, i have two me id's where there is similar id's in two tables. i need to find intersection of them. Is the below one correct?

count(distinct ME1)*count({<Type = {'Interactions'}>}distinct [ME ID])

ME1, [ME ID] are the two id's from two different tables

Labels (2)
8 Replies
sunny_talwar

Would you be able to show it with a help of a sample to show what you have and what you are trying to count?

prutis66
Contributor III
Contributor III
Author

Hi Sunny, Thnx for reply. Just imagine there are two tables one table is having one set of me id's with id name "ME1" the other table is having set of me id's with id name "[ME ID]" . As shown in previous post, I need to find intersection of me id's(it means two tables are having common me id's)

sunny_talwar

May be this

Count(DISTINCT {<[ME ID] = P(ME1)>} [ME ID])

prutis66
Contributor III
Contributor III
Author

will add some example later on , meanwhile can you help me with resident load not working with where exists?

THanks in advance

ME:
LOAD
ME1,

abc

from file.xyz;

Interactions:
LOAD
"ME ID",
"MSL ID"

from file2.xyz;

inc:
load
"ME ID" as ME_ID_Incn,
"MSL ID" as MSL_ID_Incn
Resident Interactions
Where Exists(ME1);

sunny_talwar

May be try this

Where Exists(ME1, "ME ID");

prutis66
Contributor III
Contributor III
Author

Thanks Sunny for Reply!! but it is giving id's which are in other table I want only id's which are same as  in table where ME1 is present.

 

sunny_talwar

Can you share few rows of data from each table and explain what the output needs to look like from the sample data you have shared?

prutis66
Contributor III
Contributor III
Author

Hi Thanks,

For your understanding  I am attaching excel, which has two tables "interactions" and "ME". Say ME is like doctor and MSL is like salesrep. MSL's  have specifically assigned me's to them and they make interactions. In general msl's can interact with me's even though some ME is not assigned to them.

Interaction data is given in "interactions" table, me's assigned to msl is given in "ME" table.

 

Now my requirement is I have to find count of me's which have interactions only with me's assigned to them. So is why I wrote below script:

ME:
LOAD
ME1,

abc

from file.xyz;

Interactions:
LOAD
"ME ID",
"MSL ID"

from file2.xyz;

inc:
load
"ME ID" as ME_ID_Incn,
"MSL ID" as MSL_ID_Incn
Resident Interactions
Where Exists(ME1);

The inc table  should ideally give msl details who have interacted with me's present in "ME" table. Hope this is clear.