Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Howdy, I am trying to make a conditional if statement for a color expression in qlik sense. It goes something like this:
if((decile = '1' or decile = '2' or decile = '3' or decile = '4'), green(),
if (decile = '5' or decile '6' or decile = '7')
,blue()
if(decile = '8' or decile = '9' or decile = '10')
,red())
but for some reason I am still getting an error on parenthesis, 'expecting a ')'. Any assistance?
Another one would be:
If(Match(decile, 1, 2, 3, 4), Green(),
If(Match(decile, 5, 6, 7), Blue(),
If(Match(decile, 8, 9, 10), Red())))
in the tirdh row ypou need a "," at end of blue()
if((decile = '1' or decile = '2' or decile = '3' or decile = '4'), green(),
if (decile = '5' or decile '6' or decile = '7')
,blue(),
if(decile = '8' or decile = '9' or decile = '10')
,red())
and you need add two ) at the end
See:
if ((decile = '1' or decile = '2' or decile = '3' or decile = '4'), green(),
if ((decile = '5' or decile '6' or decile = '7'), blue(),
if ((decile = '8' or decile = '9' or decile = '10'), red())))
Try like this
if((decile <= 4
, green()
, if (decile >= 5 and decile <=7
,blue()
, red()
)
)
Another one would be:
If(Match(decile, 1, 2, 3, 4), Green(),
If(Match(decile, 5, 6, 7), Blue(),
If(Match(decile, 8, 9, 10), Red())))
Or like this
Pick(decile
, green(),green(),green(),green()
,blue(),blue(),blue()
,red(),red(),red()
)
Stefan do you think we can go away with >= 5 from your proposal? Like the below
If(decile <= 4, green(),
If(decile <= 7, blue(), red()))
Sure, you are right!
A lot of time people has asked me if the above as true as what you have proposed and I have always wondered if there is a time when they won't give the same result. I guess never
Unless decile is not an integer ...
Right, that is true