Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Chinnu3
Contributor III
Contributor III

How to find unique values from Table A and table B(Common needs to be avoided)

I have Table A

ID Availability
1 high
2 medium
3 low
4 low
5 low
6 high
7 medium
8 medium

and Table B

ID approve_date
1 20-04-2022
3 23-04-2022
8 24-04-2022

 

I want the values which which Table A has and Table B doesn't have.

Final table should be like this

ID Availability
2 medium
4 low
5 low
6 high
7 medium

 

How can i get this?

Thanks in advance for your help...

Labels (4)
4 Replies
Vegar
MVP
MVP

Try something like this:

ExludedIDs:
LOAD ID as ExcludedID
FROM TableB;

FinalTable:
LOAD ID, Availability
FROM TableA
WHERE NOT Exists(ExcludedID , ID);

DROP TABLE ExludedIDs;

Chinnu3
Contributor III
Contributor III
Author

Thanks for your quick reply...

Chinnu3
Contributor III
Contributor III
Author

Can u explain a little more with clear script?

thank you

Vegar
MVP
MVP

Try pasting this script into your script editor.

ExludedIDs:
LOAD ID as ExcludedID
INLINE [		
ID,  approve_date
1,   20-04-2022
3,   23-04-2022
8,   24-04-2022
];

FinalTable:
LOAD ID, Availability
INLINE  [
ID, Availability
1,  high
2,  medium
3,  low
4,  low
5,  low
6,  high
7,  medium
8,  medium
]
WHERE NOT Exists(ExcludedID , ID);

DROP TABLE ExludedIDs;

You will end up with a FinalTable table with data as in the image below.

Vegar_0-1650958990406.png