Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AJDoc31
Contributor III
Contributor III

Conditional coloring for KPI

Hello All,

I am trying to change the color of a KPI measure based on a variable. For example I have two buttons that toggle a variable from Value1 to Value2. I want to color the KPI text green when it’s Value1 and black when it’s Value2.


My other issue is that the KPI also updates what it’s actually showing on another variable input. So it could be the median of variable A,B, or C depending on the user input. So setting conditional limits does not work as it normally would.

Does anyone know how this could be accomplished? Thanks in advance!

Labels (5)
1 Solution

Accepted Solutions
AJDoc31
Contributor III
Contributor III
Author

Playing around with this, I used your statement from above and did:

IF(vSiteSelection = 'Site A', RGB(17,217,0),0.01) 

Then is manually assigned colors in the limit, as the alternative value (site b) will always be above 0 this should work as I am expecting.

 

Thanks again for your help!

View solution in original post

3 Replies
JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @AJDoc31 

Do you perhaps have some sample data? The KPI works on a "limit" and the color is linked to that. 

So you will need a variable that has "a value" that can be used to determine the "limit" in order to calculate the color. 

 

Here is just used a sample value of 1051.

JandreKillianRIC_0-1742888146400.png

JandreKillianRIC_1-1742888162037.png

 

Here is the color (Limit) expression

=IF(vMultiSelect='Value1', 1051*2, IF(vMultiSelect='Value2', 1051-3, 1051))

 

Regards Jandre

 

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

AJDoc31
Contributor III
Contributor III
Author

Hi Jandre,

 

Thanks for your reply. Here is my equation in the KPI

Interval(Median({$< Site={"$(vSiteSelection)"},TAT_Type = {"$(vSiteTAT_1)"}>}IF(TAT_Duration>0,TAT_Duration)),'h:mm'))

 

Site Selection can be Site A or Site B

vSiteTAT_1 can be one of ten selections such as order to ship, ship to receive, order to billing, etc.

I want to color the KPI green when Site A is selected regardless of the TAT_Duration that is selected and black for Site B regardless of duration selected. I'm not sure how I could put in a limit in the KPI as the actual KPI (TAT_Duration) changes with input as well. Thanks again for your input!!

AJDoc31
Contributor III
Contributor III
Author

Playing around with this, I used your statement from above and did:

IF(vSiteSelection = 'Site A', RGB(17,217,0),0.01) 

Then is manually assigned colors in the limit, as the alternative value (site b) will always be above 0 this should work as I am expecting.

 

Thanks again for your help!