Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Background color and Set Analysis


I have created a chart that uses a Set Analysis (in the expression)
The backgrounds color should depend on values : if KPI1 > KPI2, then blue, else yellow

Then, I have to use the same Set Analysis in order to define the color definition

Example :

If the expression is :

the color definition should be :
=if(sum({$<dProduct={'ProductA'}>}KPI1) > sum({$<dProduct={'ProductA'}>}KPI2), blue(), yellow())

(I have attached an example)

This behaviour is logical (I have to consider the same set), but it is also very difficult if I want to industrialize the application... because it is not possible to store the color definition into a variable

Indeed, the color definition could be 
=if(sum(KPI1) > sum(KPI2), blue(), yellow())
=if(sum({$<dProduct={'ProductA'}>}KPI1) > sum({$<dProduct={'ProductA'}>}KPI2), blue(), yellow())
=if(sum({$<dYear={$(maxYear)}>}KPI1) > sum({$<dYear={$(maxYear)}>}>}KPI2), blue(), yellow())
and so on... (and my application is much more complicated...)

Do you have any idea how to manage this ?

1 Reply
Valued Contributor

Re: Background color and Set Analysis

you forgot ")"

=if(sum(KPI1)>sum(KPI2),blue(), Yellow())

hope that help