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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
agsearle
Creator
Creator

Multiple If's

I need to use a multiple if statement, but I can't seem to get it to work.

I have a column of data that has either a '2', a '6', a '41' or is empty. If i enter the following in a calculated dimension, in a straight table, I get all the 2's and everything else says 'None'.

IF(Lock_Category <> '2', 'None', Lock_Category)

So how can I amend this to say, if the Lock Category is not equal to 2,6 or 41, to show 'None' , but still show the 2's, 6's and 41's.

Thanks.

11 Replies
bismart
Creator
Creator

check out the MATCH function.

match( M, 'Jan','Feb','Mar')

returns 2 if M = Feb

returns 0 if M = Apr or jan

Not applicable

Andrew,

please provide sample data we can play with.

Thank you!

Rainer

bismart
Creator
Creator

IF ( Match(Lock_Category ,2,6,41) = 0, 'None',Lock_Category ) as Lock_Category

agsearle
Creator
Creator
Author

That didn't work, but this nearly does:

IF(MATCH(Lock_Category,2,6,41)=0, Lock_Category, 'None')

When used as a calculated dimension it places all the 2's and 6's correctly, and empties as 'None', but is also placing a 'None' in the 41's?

bismart
Creator
Creator

try

IF(MATCH(Lock_Category,2,6,41, '2', '6', '41')=0, 'None',Lock_Category)

Original suggestion worked for me on test script

prieper
Master II
Master II

Might be worth trying to either remove the blank before the closing bracket like ",41)" or to enclose the digits with apostrophs.

Peter

agsearle
Creator
Creator
Author

Whichever way I do it, it seems to assume that '41' is 'None', and if I put it in the script, it also makes the 41's 'None', but also leaves all the empty cells empty.

bismart
Creator
Creator

Think you must be missing something very basic.... it happens with all of us...

Post some sample data in an app and I'll have a look

sometimes the computer says 'No'

Miguel_Angel_Baeyens

Hi!

You may be missing comparing Num(Field) with 2,6,41 and all possible values you want to match. You may use as well a mapping load in the load statement. Anyway, bear in mind that QlikView doesn't have "data types". If you want to compare your date field with some dates, you better use date(field) vs. date(value) to ensure matching success...