Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Nested if for color expression

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?

1 Solution

Accepted Solutions

Re: Nested if for color expression

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())))

12 Replies
ecolomer
Honored Contributor II

Re: Nested if for color expression

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())))

MVP
MVP

Re: Nested if for color expression

Try like this

if((decile  <= 4

     , green()

     , if (decile >= 5 and decile <=7

          ,blue()

          , red()

       )

)

Re: Nested if for color expression

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())))

MVP
MVP

Re: Nested if for color expression

Or  like this

Pick(decile

, green(),green(),green(),green()

,blue(),blue(),blue()

,red(),red(),red()

)

Re: Nested if for color expression

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()))

MVP
MVP

Re: Nested if for color expression

Sure, you are right!

Re: Nested if for color expression

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

MVP
MVP

Re: Nested if for color expression

Unless decile is not an integer ...

Re: Nested if for color expression

Right, that is true

Community Browser