7 Replies Latest reply: Feb 3, 2015 4:44 PM by William Wagner

# Multiple If/than color expressions

Hello,

I am stuggling to find the correct syntax to create a 3 (or 4) color expression in QlikSense.  I am successful in Red / Green but when I attempt to create a 3rd variable or 4th, it falls apart.

Field NameSum([ISSUES P1-Critical]

Success with 2 Color Expression:  If (Sum([ISSUES P1-Critical])>10, lightred(),lightgreen())

Fail with 3 Color Expression:  Try #1

This equation fails, the error in expression states: ')' expected

if (Sum ( [ISSUES P1-Critical] ) <10, lightgreen(), if( Sum ( [ISSUES P1-Critical])=>10 and Sum ( [ISSUES P1-Critical])<=50,Yellow(), lightRed() ) )

If Sum of Issues is greater/equal to than (=<) 50, Red

If Sum of Issues is between 10 and 50 = Yellow

If Sum of Issues is less than (>) 10, Green.

Thank you

• ###### Re: Multiple If/than color expressions

hi,

your problem is the sign line 2.

if (Sum ( [ISSUES P1-Critical] ) <10, lightgreen(),

if( Sum ( [ISSUES P1-Critical])=>10 and Sum ( [ISSUES P1-Critical])<=50,

Yellow(), lightRed() ) )

=> doesn't work

>= works

Sign: =  />= / <=

Julien

• ###### Re: Multiple If/than color expressions

Julien,

Thank you for that sign help.  I no longer get an expression error, however, I am not getting a 3 color variant.

if (Sum ( [ISSUES P1-Critical] ) <10, lightgreen(), if( Sum ( [ISSUES P1-Critical])<=10 and Sum ( [ISSUES P1-Critical])>=50, Yellow(), lightRed()))

All Numbers <10 are green (that is good)

All numbers equal to or greater than 10 and less than 50 are red, the middle range between 10 and 50 is not yellow, its red too, is not getting picked up at all.  is there a better way in QlikSense to write the logical clause?

• ###### Re: Multiple If/than color expressions

Change the signs

if (Sum ( [ISSUES P1-Critical] ) <10, lightgreen(), if( Sum ( [ISSUES P1-Critical])>=10 and Sum ( [ISSUES P1-Critical])<=50, Yellow(), lightRed()))

• ###### Re: Multiple If/than color expressions

Thank you so much.  I very much appreciate your guidance.

• ###### Re: Multiple If/than color expressions

if (Sum ( [ISSUES P1-Critical] ) <10, lightgreen(),

if( Sum ( [ISSUES P1-Critical])<=10 and Sum ( [ISSUES P1-Critical])>=50, Yellow(),

lightRed()))

your expression is contradictory because line 1 you want <10 and line 2 <=10

all sign are reversed.

Try this:

if (Sum ( [ISSUES P1-Critical] ) <10, lightgreen(),

if( Sum ( [ISSUES P1-Critical])>=10 and Sum ( [ISSUES P1-Critical])<=50, Yellow(),

lightRed()))

For qliksense, it's a good way and the most simple.

• ###### Re: Multiple If/than color expressions

or try this:

if (Sum ( [ISSUES P1-Critical] ) <10, lightgreen(),

if( Sum ( [ISSUES P1-Critical])>50, lightRed(),Yellow(),))

this expression works with <10 or >50.

Sorry for my english

• ###### Re: Multiple If/than color expressions

Julien - thank you as well.  Its working now. I appreciate it.