Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
QLIK SENSE
Hi all,
I try to set up a KPI diagram. The coloring of the KPI should not depend on his own value, but on the value of another KPI. It is basically possible to code this in the color function? I tried it but it didn't work
Thx for feedback
Hello,
I believe that natively it is not possible to implement your use case scenario 100%, however this is one of they ways that you can affect the color of the KPI based on another KPI's value.
1. The KPI's value is essentially an measure calculated with an expression. Therefore, this expression can be used in any expression editor and you can use that value to affect the outcome of the other KPI color.
2. I have the following data:
3. And I also have the following KPIs:
Expression: =Sum({<[Dates.autoCalendar.Year]={'2020'}>}Values)
Expression: =Sum({<[Dates.autoCalendar.Year]={'2021'}>}Values)
4. Now you can edit the first KPI and under Appearance > Presentation > Color, you can select:
As you can see, I have enabled "Conditional colors" and disabled "Library colors". After that I have added a limit and I have specified that below that limit the color will be RED and above that limit the color will be GREEN.
Here is how the KPI looks now:
5. As you can see, the color is GREEN because the value that is used is 450 which is exactly on the limit and it is the value of the current KPI as well. Now if we modify the expression of the value and we use the KPI 2's expression: =Sum({<[Dates.autoCalendar.Year]={'2021'}>}Values) then the KPI changes color as:
Because current KPI value is 450 and with the expression the limit is now 650 (which is the value of the other KPI). therefore, 450 is below the limit which is 650, so the color changes. Personally, I believe that this is as close as you can get to the desired outcome. However, if you would like to have a more advance control over the color, then you can submit a feature request [1] and specify that you would like to have an option, where you can add an expression and based on that expression return a custom color code that will be used as the color of the KPI.
I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members.
---
Hello,
I believe that natively it is not possible to implement your use case scenario 100%, however this is one of they ways that you can affect the color of the KPI based on another KPI's value.
1. The KPI's value is essentially an measure calculated with an expression. Therefore, this expression can be used in any expression editor and you can use that value to affect the outcome of the other KPI color.
2. I have the following data:
3. And I also have the following KPIs:
Expression: =Sum({<[Dates.autoCalendar.Year]={'2020'}>}Values)
Expression: =Sum({<[Dates.autoCalendar.Year]={'2021'}>}Values)
4. Now you can edit the first KPI and under Appearance > Presentation > Color, you can select:
As you can see, I have enabled "Conditional colors" and disabled "Library colors". After that I have added a limit and I have specified that below that limit the color will be RED and above that limit the color will be GREEN.
Here is how the KPI looks now:
5. As you can see, the color is GREEN because the value that is used is 450 which is exactly on the limit and it is the value of the current KPI as well. Now if we modify the expression of the value and we use the KPI 2's expression: =Sum({<[Dates.autoCalendar.Year]={'2021'}>}Values) then the KPI changes color as:
Because current KPI value is 450 and with the expression the limit is now 650 (which is the value of the other KPI). therefore, 450 is below the limit which is 650, so the color changes. Personally, I believe that this is as close as you can get to the desired outcome. However, if you would like to have a more advance control over the color, then you can submit a feature request [1] and specify that you would like to have an option, where you can add an expression and based on that expression return a custom color code that will be used as the color of the KPI.
I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members.
---
Hello Andrei,
I wish you a happy new year!
The use case scenario is correct interpretated. It's just that in my case one KPI is an absolute number and the other KPI is a relative number. The absolute number should be colored according to the current value of the relative number. Is this possible?
I have tried your solution, but it did not work.
Use case:
GPS Device | Data sent last 24h |
1 | yes |
2 | yes |
3 | yes |
4 | yes |
5 | no |
6 | yes |
7 | yes |
8 | yes |
9 | no |
10 | yes |
11 | yes |
12 | yes |
13 | yes |
14 | yes |
15 | yes |
KPI 1: number of GPS devices = count(GPS Device) = 15
KPI 2: number of GPS devices without answer last 24h = count(GPS Device) where 'Data sent last 24h' = 'no' = 2
KPI 3: Rate of non-transmitting devices = KPI2/KPI1 = 2/15 = 13,33%
GOAL: KPI 2 should be colored according to the current value of KPI 3
Example: KPI 3 coloring
if KPI 3 <= 7% than GREEN, if KPI 3 > 7% and < 14% than YELLOW, if KPI 3 >= 14% then RED.
In this case KPI 2 will be GREEN if = 0 or 1, YELLOW if KPI 2 = 2 and RED if KPI 2 > 2.
If the number of devices increases in the future (KPI 1) the rate (KPI 3) will change and so the coloring of KPI 2, too.
Thx for help