Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Kpim
Partner - Contributor
Partner - Contributor

If statement with two conditions

Hi

I have been trying the code below but it doesn't return the result expected. 

Field names:

fruits              Region

A_fruit          Urban_low

O_fruit         Rural_high
 B_fruit         Rural_high             

If(fruit = 'A', 'yellow', if(region = 'Urban', 'yellow, 'blue')

This code returns 'blue' only and I want it to return :

'yellow',

'blue'

'blue'

Labels (1)
1 Reply
BrunPierre
Partner - Master
Partner - Master

As below

IF(Match(SubField(Fruit,'_',1),'A'),'Yellow',
IF(Match(SubField(Region,'_',1),'Urban'),'Yellow','Blue'))