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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ValeriaBonini
Partner - Creator
Partner - Creator

If Condition with 4 cases

Hi, I have a column with values '1', ' 2', '3' 

my table output is like:

NAME  FLAG

AA       1

BB       3

CC        2

DD       

 

How Can i have an output like 

NAME  FLAG    RESULT

AA       1               IN

BB       3              OUT

CC        2              OVER

DD                        EMPTY FLAG

Labels (6)
5 Replies
DS395
Contributor III
Contributor III

Hi,

you can do it in diffrent ways. That should be the easiest: 

IF( FLAG = 1, 'IN', IF(FLAG = 2,'OVER', IF(FLAG = 3,'OUT','EMPTY FLAG')))

 

Best regards

dash

Rams-
Creator
Creator

Hi,

You can use nested IF condition:

IF( FLAG = 1, 'IN', IF(FLAG = 3,'OUT', IF(FLAG = 2,'OVER','EMPTY FLAG')))

Output:

Rams_0-1682504310713.png

 

Hope this helps,

help user find answers ! don't forget to mark  a solution that work for you and click the like button!

 

Prem0212
Creator
Creator

load

NAME,
FLAG,
IF(FLAG=1, 'IN', IF(FLAG=2, 'OVER', IF(FLAG=3, 'OUT', 'EMPTYFLAG'))) as RESULT

Inline

[

NAME, FLAG

AA, 1

BB, 3

CC, 2

DD,

];

I hope this will work for u.

Please accept the solution if u liked it

 

Chanty4u
MVP
MVP

Try this

LOAD 

    NAME, 

    FLAG, 

    IF(ISNULL(FLAG), 'EMPTY FLAG', MATCH(FLAG, '1', '2', '3'), 'RESULT') AS RESULT

FROM 

    [your_table];

 

anat
Master
Master