Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Background color and Set Analysis

Hello,

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 :
=sum({$<dProduct={'ProductA'}>}KPI1)

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())
OR
=if(sum({$<dProduct={'ProductA'}>}KPI1) > sum({$<dProduct={'ProductA'}>}KPI2), blue(), yellow())
OR
=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
fdelacal
Specialist
Specialist

you forgot ")"

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

hope that help