Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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
Partner - Specialist
Partner - Specialist

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

View solution in original post

1 Reply
marksouzacosta
Partner - Specialist
Partner - Specialist

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