Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld online is next week! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Evan0211
Creator
Creator

If statement with multiple conditions

I need to write an if statement in QLIK Sense that checks one column in a table for multiple conditions.

Essentially, I need to check if the column has 'Red', 'Blue', or 'Green' and if it does, show the data.

I know how to limit it to one:

=if([Color]='Blue',[Color])

but I am unsure the syntax of multiple conditions as a new user.  Ideally, I would prefer to make the colors a variable so if the requirement changes, I only have to change it in the variable instead of in the expression editor.

Any help is appreciated 

1 Solution

Accepted Solutions
Or
Master III
Master III

You could use logical OR statements, e.g.

If(Color = 'Blue' or Color = 'Green' or Color = 'Red', Color)

You could also use Match:

If(Match(Color,'Blue','Green','Red'),Color)

Using a variable might be tricky because you want to be able to use multiple colors, but if you just want to allow one additional color to be selected in the variable, you could add/replace the variable into the color list. 

View solution in original post

2 Replies
Or
Master III
Master III

You could use logical OR statements, e.g.

If(Color = 'Blue' or Color = 'Green' or Color = 'Red', Color)

You could also use Match:

If(Match(Color,'Blue','Green','Red'),Color)

Using a variable might be tricky because you want to be able to use multiple colors, but if you just want to allow one additional color to be selected in the variable, you could add/replace the variable into the color list. 

Evan0211
Creator
Creator
Author

Thank you.