Search code examples
qliksense

Qlik sense 2 condition string


I am trying to make an if statement:

if(product = 'a', 'red', if(city = 'south', 'red', 'green')

This returns green only. I want it to return red and green

What am I doing wrong?


Solution

  • It's hard to say whether there's an issue with your data, the expression, or your logic without seeing your data, but here is a screenshot that explains a few different scenarios for your If() expression:

    Screenshot of a Qlik Sense table showing the results on an If expression

    Make sure you are using the If() function correctly -- if it's not returning what you're expecting it to based on your intended logic, maybe consider adding in some AND and OR operators as needed to apply the correct logic to the expression. You can also see some more examples of using the If() function on this Qlik Help page.

    Feel free to edit your question with an example of your data if you have further questions!