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: 
pjpkumar26
Contributor III
Contributor III

IF Statement

Hi Friends,

can anyone please let me know how to do this simple if in Qlik sense 

If Product  is 'Food' then the tax rate is 7.5%, if the Product is Drink then the tax rate is 9.5%.

 

Thanks,

Kumar

Labels (3)
3 Replies
AlexMonz
Partner - Contributor
Partner - Contributor

Hello Kumar,

as far as I understand your case, this should work (in the load script as well as in sheet expressions) by nesting a second if in the "else" part of your if-condition, just like below:

if(Product='Food', 0.075, if(Product='Drink', 0.095, defaultValue))

Replace the default value with whatever Tax Rate you want to apply if the Product is neither "Food" nor "Drink". If you only have food or drinks, then you could just write one single if condition:

if(Product='Food', 0.075, 0.095)

Hope this helps.

Alex

Iswarya_
Creator
Creator

Hi @pjpkumar26 ,

=pick(match(product,'Food','Drink'),'7.5%','9.5%')

Iswarya_
Creator
Creator

If the issue is solved please mark the answer with Accept as Solution.