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: 
Bantamfan84
Contributor
Contributor

Multiple If Statements

I need to display some data on a table where 4 different flags evaluate as true 

So for example :

if Flag 1 = Y display abc, if flag 2 = Y display cde if Flag 3 = y display fgh if flag 4 = y display ijk

Is this possible with if statements? and if so how as i've tried multiple ways but can't get it to work

Thanks

Labels (1)
1 Solution

Accepted Solutions
marksouzacosta

Hi @Bantamfan84,

Is this what are you looking for?

MyData:
LOAD 
  Flag1,
  Flag2,
  Flag3,
  Flag4,
  If(Flag1 = 'Y', 'abc', 
   If(Flag2 = 'Y', 'cde',
    If(Flag3 = 'Y', 'fgh',
      If(Flag4 = 'Y', 'ijk')))) AS Display
INLINE [
Flag1, Flag2, Flag3, Flag4
Y,A,A,Y
B,Y,C,C
B,Z,Y,C
Y,Y,Y,Y
];

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

View solution in original post

1 Reply
marksouzacosta

Hi @Bantamfan84,

Is this what are you looking for?

MyData:
LOAD 
  Flag1,
  Flag2,
  Flag3,
  Flag4,
  If(Flag1 = 'Y', 'abc', 
   If(Flag2 = 'Y', 'cde',
    If(Flag3 = 'Y', 'fgh',
      If(Flag4 = 'Y', 'ijk')))) AS Display
INLINE [
Flag1, Flag2, Flag3, Flag4
Y,A,A,Y
B,Y,C,C
B,Z,Y,C
Y,Y,Y,Y
];

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com