Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
kev6brown
Partner - Creator
Partner - Creator

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
Partner - Master

@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()))