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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
tsachdev421
Contributor II
Contributor II

Qlik: If condition Col 1 vs Col 2

tsachdev421_0-1660579417027.png 

>> If there is a text value In Column 2 (other than '-' or Null), value in Column 2 should be displayed as output.
>> If Col 1 has value and Col 2 is Null or '-', value in Col 1 should be displayed as o/p.
>> If Col 1 and Col 2 both has text value. text in Col 2 should be displayed as o/p

Logic Used: if ("Col 1" = '-' or len(trim("Col 1")) = 0, "Col 2", "Col 1" ) 

Note: Above if Condition requires modification.

 

 

 

Labels (2)
2 Replies
Taoufiq_Zarra
MVP
MVP

@tsachdev421  if I understood correctly

you can use this :

load *,if(len(trim([Column 2]))>0,[Column 2],if(len(trim([Column 1]))>0,[Column 1])) as output;

load replace([Column 1],'-','') as [Column 1] ,replace([Column 2],'-','') as [Column 2] inline [
Column 1,Column 2
Text1,Text2
Text3,
Text4,-
Text5,Text6
Text7,-
Text8,Text9
-,Text10
-,-
]

 

output:

Taoufiq_Zarra_0-1660596979406.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
rwunderlich
MVP
MVP

How about:

Coalesce([Column 2], [Column 1])

-Rob