Forum Discussion
KPI visual background colour conditional formatting based on changing value
So, I have a KPI card where the value for a department is measured against the total for the company for sickness days lost per FTE. Good is for the dept value to be below the company value. The KPI text colour works fine showing green if below company, red if above etc. But is there any way in PBI which allows me to do that for the background colour as this would make the visual stand out more? Its not a simple case of entering a static value in a conditional formatting rule as the target value with change each month.
Hi Fusilier2 - Yes! You can dynamically set the background color of your KPI card based on whether the department's value is above or below the company value by using conditional formatting with a measure.
KPI_Background_Color =VAR DeptValue = SELECTEDVALUE('Sal1'[OrderID])VAR CompanyValue = SELECTEDVALUE('Sal1'[OrderID])
RETURNIF(DeptValue < CompanyValue, "#C3E6CB", // Green for goodIF(DeptValue > CompanyValue, "#F8D7DA", // Red for bad"#FFF3CD")) // Yellow for neutralHope this helps.
Thank you very much!
The people on this forum are so helpful.
2 Replies
- rajendraongole1Super User
Hi Fusilier2 - Yes! You can dynamically set the background color of your KPI card based on whether the department's value is above or below the company value by using conditional formatting with a measure.
KPI_Background_Color =VAR DeptValue = SELECTEDVALUE('Sal1'[OrderID])VAR CompanyValue = SELECTEDVALUE('Sal1'[OrderID])
RETURNIF(DeptValue < CompanyValue, "#C3E6CB", // Green for goodIF(DeptValue > CompanyValue, "#F8D7DA", // Red for bad"#FFF3CD")) // Yellow for neutralHope this helps.
- Fusilier2Helper V
Thank you very much!
The people on this forum are so helpful.