Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Replace multiple IFs statement by IF list contains

In a calculated dimension for a pivot table, I would like to test the condition

IF(MyField in ['A','B','C','D'])

For now, I am doing

IF(MyField = 'A' OR MyField = 'B' OR MyField = 'C' OR MyField = 'D', ..., ...)

Since expression for MyField is heavy, I would like to replace this by a more efficient syntax, such as search in a list (like a contains() method in other languages). Is there such a syntax?

Thanks in advance!

1 Solution

Accepted Solutions
its_anandrjs

Yes you are right or may be you can use Index() function for this.

View solution in original post

3 Replies
its_anandrjs

You can try match function also

Ex:-

=IF( Match( MyField,'A','B','C','D' ))

Not applicable
Author

is =IF( Match( MyField,'A','B','C','D' ),...,...) strictly equivalent to IF(MyField = 'A' OR MyField = 'B' OR MyField = 'C' OR MyField = 'D', ..., ...) ?

its_anandrjs

Yes you are right or may be you can use Index() function for this.