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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Karthick30
Creator
Creator

How to Compare 2 columns and create new column

HI,

 I have 2 columns. I need to compare those 2 columns and create a new column called Flag. It should have only 0 and 1.

Karthick30_0-1668611796552.png

In this Dataset.. Column 1 is Primary column and column 2 is the comparison column. Column 1 has PostMan and column 2 has Mpostman. So column 2 has Postman word along with Letter 'M'. so it is true condition. So i need flag column has 1 as output.

we need to check Column 2 with Column 1. Column 2 has some additional characters in prefix or Suffix.( we can ignore that). but it will not follow same pattern. 1 or 2 additional characters in Prefix or Suffix will be there. Any way to compare this and get desired output

Labels (1)
1 Solution

Accepted Solutions
hoangvvo
Partner - Contributor III
Partner - Contributor III

load *,
if(WildMatch(Column2,'*' & Column1 & '*'),1,0) as Flag;
load * inline
[Column1,Column2
PostMan,Mpostman
Laptop,ylaptopxy
Greek,Mgkeey
Finance,FinXy];

 

Wildmatch QLik help: https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/Conditi...

 

View solution in original post

1 Reply
hoangvvo
Partner - Contributor III
Partner - Contributor III

load *,
if(WildMatch(Column2,'*' & Column1 & '*'),1,0) as Flag;
load * inline
[Column1,Column2
PostMan,Mpostman
Laptop,ylaptopxy
Greek,Mgkeey
Finance,FinXy];

 

Wildmatch QLik help: https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/Conditi...