Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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)
Use Match() function
If(Match(country, 'US', 'Canada'), Value
May be like:
If(Country = 'US' and Segment = 'Consumer', Sales,If(Match(Country,'US','Canada'),Sales,0))
Sunny - thanks for the reply but it is only picking up the first field, not all three, how should I modify it?
Can you elaborate or share a sample to show the problem?
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!
All three are selected at the sample time?
Yes correct, as an example when all three (in the formula) are selected I want it to be 30MM. Thanks Sunny
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)
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