Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sjar1290
Contributor II
Contributor II

Compare two columns

Hi ALL,

I need to compare two columns in a table, 

FIELD1 Field2
A Z
B B
C X
D Y
E T
N M
O O

 

I want the result should be like this

FIELD1 Exists Field2
A Exists in Field1  
  Exists in Field2 Z
B Exists in Both B
C Exists in Field1   
  Exists in Field2 X
D Exists in Field1   
  Exists in Field2 Y
E Exists in both E

any help would be appreciated.

Thank you!

Labels (3)
1 Reply
Mark_Little
Luminary
Luminary

Hi @sjar1290 

 

If it understand the request you will need something like this.

Temp:

LOAD 

Field1,

Field2,

IF(Field1 = Field2,1,0) as Flag

From ...

Noconcatenate

Final:

Load

Field1

Resident Temp

Where Flag =0;

Concatenate

Final:

Load

Field2

Resident Temp

Where Flag =0;

Final:

Load

Field1,

Field2,

Resident Temp

Where Flag =1;

Drop Table Temp;