Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Can you reference the value of an expression in Background Color properity

I'd like to avoid re-writing an expression as part of the background color statement for said expression.

For example

Expression =  Sum(A)/Sum(B)

Background Color = if( Value_of_Expression > A, Green(),

                              if( Value_of_Expression > B, Yellow(), Red() ) )

Replacing "Value_of_Expression" with the actual expression works, but it's difficult to maintend for complicated expressions.

Do alternative methods exist?

Thanks,

Ben

4 Replies
Not applicable

Re: Can you reference the value of an expression in Background Color properity

Ben,

I am not sure if you can do that directly.

However, you can use a variable to store the expression and the condition to display the color and then call this variable in the background color property.

Hope that helps.

-Regards,

-Khaled.

Not applicable

Re: Can you reference the value of an expression in Background Color properity

Ben,

Try something like this:

=if([Expression]>=3,Red(),Green())

where [Expression] is the label of the expresssion you are writing.

Please find the attachment.

Hope that helps.

-Khaled.

Highlighted
Not applicable

Re: Can you reference the value of an expression in Background Color properity

define a variable with parameters

ColorCondition = if( $1 > $2, Green(), if( $1 > $3, Yellow(), Red() ) )

and define your expressions as variables

Share = Sum(A)/Sum(B)

and then use

$(ColorCondition($(Share), A, B))

as the expression for your color.

Not applicable

Re: Can you reference the value of an expression in Background Color properity

You can refer directly to the name of the expression.

eg. Your expression is:

Sum(A)/Sum(B)

The expression name is:

A div B

In the background colour expression box you put:

If([A div B] > A, Green(),

  If([A div B] > B, Yellow(), Red()))

Community Browser