Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

villegasi03
Contributor

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

Re: Set Color of Background Based on Value

Hi Villegas,

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

Regards,

Arun.

6 Replies
whiteline
Honored Contributor II

Re: Set Color of Background Based on Value

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

Re: Set Color of Background Based on Value

Pass me the file.

Gabriel
Valued Contributor II

Re: Set Color of Background Based on Value

Hi,

Can you provide the data in excel file, please.

Not applicable

Re: Set Color of Background Based on Value

Hi Villegas,

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

Regards,

Arun.

villegasi03
Contributor

Re: Set Color of Background Based on Value

Qvarunprasadh,

Exactly what I was looking for thank you!

Not applicable

Re: Set Color of Background Based on Value

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

Regards,

Gerd Neumann

Community Browser