# QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
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
Highlighted
Not applicable

## Re: Set Color of Background Based on Value

Hi Villegas,

Regards,

Arun.

6 Replies
Highlighted
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.

Highlighted
Not applicable

## Re: Set Color of Background Based on Value

Pass me the file.

Highlighted
Partner

## Re: Set Color of Background Based on Value

Hi,

Can you provide the data in excel file, please.

Highlighted
Not applicable

Hi Villegas,

Regards,

Arun.

Highlighted
Contributor