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: 
vikasshana
Creator III
Creator III

How to use OR in if statement

Hi,

I've below data.

ID New Value
1 abc 123
1 abc 456
1 abc 789
2 efg 963

 

I'm using the below IF statement to show the three values if I select 'abc' but it is showing only value '123'

if(match(ID,'1') and match(New'abc'),'123',if(match(ID,'1') and match(New,'abc'),'456' ,
if(match(ID,'1') and match(New'abc'),'789')))

I'm looking for an IF Statement to show all the three values if I select 'abc'.

Regards,

Vikas

@PrashantSangle @tresesco @sunny_talwar 

Labels (4)
5 Replies
BrunPierre
Partner - Master II
Partner - Master II

Try this

IF(Match(ID,'1') and WildMatch(New,'*abc*'),Value,Null()) as [abc Values]

MarcoWedel

Where are you applying this expression and what is your expected result regarding those three values given that a single expression only returns a single value per evaluation?

vikasshana
Creator III
Creator III
Author

I'm trying to apply this in the load script, my expected result is if user select abc the result should be three values associated to abc (123, 456, 789)

vikasshana
Creator III
Creator III
Author

Tried this but not giving the expected result.

BrunPierre
Partner - Master II
Partner - Master II

Hi @vikasshana 

I can assure you that the syntax works perfectly. And because it's conditioned selecting the value abc won't alter the output values.

LOAD *,IF(Match(ID,'1') AND WildMatch(New,'*abc*'),Value,Null()) as [abc Values];

LOAD * Inline[
ID,New,Value
1,abc,123
1,abc,456
1,abc,789
2,efg,963
];

O/P

BrunPierre_0-1664432883998.png