Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
abc_18
Creator II
Creator II

How to write multiple if conditions

Hi,

I have a column 'Status' with values from 1 till 10.

I have to implement a condition for this column like below:-

if(status=('1,2,3,5,6,7'),'Open',
if(status=('4,8,10'),'Closed',
if(status=('9'),'Rejected')) as Status_definition, I tried using this but not getting desired output.

Please suggest

Labels (1)
4 Replies
Anil_Babu_Samineni

I would rather use Match() function like. Since you have number's you no need to consider as string. If you have text in status, you hav do draft 'Yes','No' etc.

if(Match(status, 1,2,3,5,6,7),'Open', if(Match(status, 4,8,10),'Closed', if(Match(status, 9),'Rejected'))) as Status_definition

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
martinpohl
Partner - Master
Partner - Master

use

if(match(status,'1','2','3','5','6','7'),'Open',
if(match(status,'4','8','10'),'Closed',
if(status='9','Rejected')) as Status_definition

instead

abc_18
Creator II
Creator II
Author

Thanks Anil

Anil_Babu_Samineni

Please accept correct answer to track this ticket and it will help for community managers to sort out on their DB.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful