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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
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 II
Partner - Master II

As below

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