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: 
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
Champion III
Champion III

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

View solution in original post

3 Replies
its_anandrjs
Champion III
Champion III

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
Champion III
Champion III

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