7 Replies Latest reply: Jul 24, 2017 2:40 PM by Mary Jo Taft

# I am using "Color by expression" but the graphics are gray

Hi,

I am using "Color by expression" but the graphics are gray

The Dimension:

=if((DRIVERTIME < 341),'LOW',

if((DRIVERTIME >= 341) And (DRIVERTIME < 361),'MEDIUM',

if((DRIVERTIME >= 361),'HIGH')))

The Measure:

=Count(TRIPS)

Color by expression:

=if((DRIVERTIME < 341),Green(),

if((DRIVERTIME >= 341) And (DRIVERTIME < 361),Yellow(),

if((DRIVERTIME >= 361),Red())))

THANKS!!

• ###### Re: I am using "Color by expression" but the graphics are gray

I would suggest finding the RGB value of the colour and using that e.g.

if("Gender"='Male',rgb(68,119,170),if("Gender"='Female',rgb(204,102,119), rgb(253,219,102)))

• ###### Re: I am using "Color by expression" but the graphics are gray

Bella, thanks

I also tried that option, but it does not work either

Rodrigo

• ###### Re: I am using "Color by expression" but the graphics are gray

Because the color expression is calculating over multiple rows, you must do some sort of aggregation over DRIVERTIME. As you have it now in the IF(), DRIVERTIME will return null when there are multiple rows. Try using "Avg(DRIVERTIME)" in your color expression.

-Rob

http://qlikviewcookbook.com

• ###### Re: I am using "Color by expression" but the graphics are gray

Eureka !!! That was the problem, thank you very much!!!

• ###### Re: I am using "Color by expression" but the graphics are gray

If you found the document clip useful, please mark my response as correct or appropriate.

Thank you

• ###### Re: I am using "Color by expression" but the graphics are gray

Please mark Rob Wunderlich's response as correct since you indicated that resolved your question.  I selected this question because it was still marked as unanswered - but upon reading it, you did get a correct response and it just needs to be marked.

Thank you.

• ###### Re: I am using "Color by expression" but the graphics are gray

Please check if this might be the reason.

Are you using alternative dimension?