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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kev6brown
Partner - Creator II
Partner - Creator II

Nested IF

I'm looking to create a dimension in a table using an IF statement but it's not working. So I have - 

 

IF FeedType <> 'OUTS' and RefDesc ='PSCD*' or 'PHCD*' or 'PHTD', 04,

IF Feedtype = 'OUTS'  OR RefDesc= 'HICD*', '05'

 

What am I doing wrong?

Labels (1)
3 Replies
Mark_Little
Luminary
Luminary

When you do an OR you do have to define the field again or use the Match() function. i.e.

IF RefDesc='x' or RefDesc='y'..

Might be worth reviewing the wildmatch() function also.

AL07
Partner - Contributor
Partner - Contributor

Can you elaborate your requirement as if you need any of the following values?
RefDesc ='PSCD*' or 'PHCD*' or 'PHTD' ALSO  Feedtype = 'OUTS'  OR RefDesc= 'HICD*', '05' - Wether it is "or" or "And"

After clearing your posted statement try this:

=IF (FeedType <> 'OUTS' and RefDesc ='PSCD*' or 'PHCD*' or 'PHTD', 04,
IF (FeedType = 'OUTS' OR RefDesc= 'HICD*', '05'))


Thanks!!

BrunPierre
Partner - Master II
Partner - Master II

@kev6brown  As below.

If(not Match(FeedType,'OUTS') and WildMatch(RefDesc,'PSCD*','PHCD*','PHTD'), 04,
If(Match(FeedType,'OUTS') or WildMatch(RefDesc,'HICD*'), 05, Null()))