Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlik expressions: Multiple selections within a filter

Hello Qlik Community,

I am trying to write an expression where I can use the filters and data points change.

I can do if statements, such as if(country='US' and segment='Consumer', but I need help with a next step:

How would I write if there are two countries (Within the same field) Such as: If(country=US and Canada,Value

Please let me know if there is a solution to this. I appreciate it.

thank you

Ken

1 Solution

Accepted Solutions
sunny_talwar

May be this

If(

SubStringCount(Concat(DISTINCT '|' & [Accounting Country] & '|'), '|US Consumer|') = 1 and

SubStringCount(Concat(DISTINCT '|' & [Accounting Country] & '|'), '|US Pharm|') = 1 and

SubStringCount(Concat(DISTINCT '|' & [Accounting Country] & '|'), '|US MD&D|') = 1,

3000000000)

View solution in original post

12 Replies
sunny_talwar

Use Match() function

If(Match(country, 'US', 'Canada'), Value

balabhaskarqlik

May be like:

If(Country = 'US' and Segment = 'Consumer', Sales,If(Match(Country,'US','Canada'),Sales,0))

Anonymous
Not applicable
Author

Sunny - thanks for the reply but it is only picking up the first field, not all three, how should I modify it?

sunny_talwar

Can you elaborate or share a sample to show the problem?

Anonymous
Not applicable
Author

Selections.PNGformula.PNG

this formula you gave only works, when US Consumer is selected, I would like it to work when US Consumer US MD&D and US Pharm are selected, thanks for your help!

sunny_talwar

All three are selected at the sample time?

Anonymous
Not applicable
Author

Yes correct, as an example when all three (in the formula) are selected I want it to be 30MM. Thanks Sunny

sunny_talwar

May be this

If(

SubStringCount(Concat(DISTINCT '|' & [Accounting Country] & '|'), '|US Consumer|') = 1 and

SubStringCount(Concat(DISTINCT '|' & [Accounting Country] & '|'), '|US Pharm|') = 1 and

SubStringCount(Concat(DISTINCT '|' & [Accounting Country] & '|'), '|US MD&D|') = 1,

3000000000)

Anonymous
Not applicable
Author

Didn't work either unfortunately 😕 I copied and pasted your reply in, would I have needed to modify anything? If not, is there another possibility? I appreciate the help thus far