Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
villegasi03
Creator
Creator

Set Color of Background Based on Value

QV Community,

I am hoping that someone could help me with a question about setting colors in charts/tables based on a value. Specificlly, I have a straight table and want to set the color of the backgroup for the expression based on the calculated value. I know I can use some "IF"statements to do this but to be honest I am tired of having to do this for each place where I am calculating this particular value.

1) Can you refer to an aggragation by using the name of the label?

IF(sum(value1)/sum(2) >= 1 and sum(value1)/sum(2) <= 10,rgb(255,0,0),

     if(sum(value1)/sum(2) >= 11 and sum(value1)/sum(2) <= 20, rgb(1,1,1) , rgb(1,2,3)))

OR could I....

IF([LABEL]>= 1 and []LABEL <= 10,rgb(255,0,0),

     if([LABEL] >= 11 and [LABEL] <= 20, rgb(1,1,1) , rgb(1,2,3)))

I have a hand full of statistics that I have to do this for so if there anything out there in the form of a template or reference that can provide an easier way to do this?

Thank you,

1 Solution

Accepted Solutions
Not applicable

Hi Villegas,

Please find the attached file. hope it ll help you.

Regards,

Arun.

View solution in original post

6 Replies
whiteline
Master II
Master II

You can assign your complex expresion to some variable. For example exValueColor.

And than use $(exValueColor) instead of all that complex expression.

where the value of exValueColor is  an expression without leading '='.

Its very useful method to store color expressions (like rgb(1,1,1)). Otherwise its realy hard to change colors if you have dozens of expressions.

From one side you have the same simple expression everywhere, from the other - you will soon forget what expression was stored in the variable.

Not applicable

Pass me the file.

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Can you provide the data in excel file, please.

Not applicable

Hi Villegas,

Please find the attached file. hope it ll help you.

Regards,

Arun.

villegasi03
Creator
Creator
Author

Qvarunprasadh,

Exactly what I was looking for thank you!

Not applicable

Can anyone post te expression please i'm searching the same thing, i can't open the file.

Regards,

Gerd Neumann