Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
luzu
Contributor II
Contributor II

Multiple Condition not working in Formula

Hello, 

I am trying to create a where clause with multiple conditions (See Below), it is not working, I am not sure why it isn't working, any ideas? 

 

where MGTRTP = ('GPT' or 'MOV' or 'CLM' or 'NE1' or 'NE2' or 'PO1' or 'WON' or 'WOP' or 'Y05' or 'Y06') ;

Labels (1)
2 Solutions

Accepted Solutions
Sayed_Mannan
Creator II
Creator II

The issue here is with the syntax of your `WHERE` clause.

In Qlik Sense, when you want to match a field with multiple values, you should use the Match function. Here's how you can modify your `WHERE` clause:


WHERE Match(MGTRTP, 'GPT', 'MOV', 'CLM', 'NE1', 'NE2', 'PO1', 'WON', 'WOP', 'Y05', 'Y06');

This will select rows where `MGTRTP` matches any of the values listed in the `Match` function.


Let me know if this helps!

View solution in original post

Anil_Babu_Samineni

This way it won't work. You need to do like this

where MGTRTP = 'GPT' or MGTRTP = 'MOV' or MGTRTP = 'CLM' .......;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

3 Replies
Sayed_Mannan
Creator II
Creator II

The issue here is with the syntax of your `WHERE` clause.

In Qlik Sense, when you want to match a field with multiple values, you should use the Match function. Here's how you can modify your `WHERE` clause:


WHERE Match(MGTRTP, 'GPT', 'MOV', 'CLM', 'NE1', 'NE2', 'PO1', 'WON', 'WOP', 'Y05', 'Y06');

This will select rows where `MGTRTP` matches any of the values listed in the `Match` function.


Let me know if this helps!

Anil_Babu_Samineni

This way it won't work. You need to do like this

where MGTRTP = 'GPT' or MGTRTP = 'MOV' or MGTRTP = 'CLM' .......;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
luzu
Contributor II
Contributor II
Author

Thank you!