Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare two variables from two tables and get the difference

Dear community.

I have a problem I cannot solve myself, and I have tried to look around in the community on solutions for similar problems, but they do not seek to work in my case.

I have two variables, which each contains PersonID's. The variables exist in two different tables and are not linked by any key.

Both tables are loaded to my QlikMart and my application.

   

Tabel 1 Tabel 2
ID_ACountID_BCount
251241
261261
271271
281291
291301
301311
321

   

Now I want to compare the PersonID's in the two variables (ID_A and ID_B) and find out which PersonID's that exist in both tables, and which only exist in one of them nnd in the last case, in which tables it then exists.

In Excel I would make the two tables into one and make a new variable saying in which table the PersonID's are from.

   

Tabel 3
ID_CCountTabel
251Tabel 1
261Tabel 1
271Tabel 1
281Tabel 1
291Tabel 1
301Tabel 1
241Tabel 2
261Tabel 2
271Tabel 2
291Tabel 2
301Tabel 2
311Tabel 2
321Tabel 2

Then I would make the table into a pivottable, so I get the following result where I can identify the PersonID's that only exist in one of the tables.

   

ID_CTabel 1Tabel 2Total
281 1
24 11
251 1
32 11
31 11
29112
27112
30112
26112
Total6713

I hope that some one has an idea of how I can get the result I want.

And I hope that it doesn't involve coding in the script, but that it can be solved by a special expression e.g. by using the agr() - function.

Please ask if anything is unclear.

In advance, thanks!

Kind regards

Line

2 Replies
settu_periasamy
Master III
Master III

May be check the attachment

Not applicable
Author

Thank you so much for replying.

However, I cannot as you do, load the tables, so the PersonID's have the same name.

Therefore, if possible, I would like to make the solution directly in my application and not in the script.

Kind regards

Line