Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Fusilier2
Helper V
Helper V

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.

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super 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])

RETURN
IF(DeptValue < CompanyValue, "#C3E6CB",  // Green for good
   IF(DeptValue > CompanyValue, "#F8D7DA",  // Red for bad
      "#FFF3CD"))  // Yellow for neutral
 
rajendraongole1_0-1743611377305.png

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Thank you very much!

The people on this forum are so helpful.

View solution in original post

2 REPLIES 2
rajendraongole1
Super User
Super 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])

RETURN
IF(DeptValue < CompanyValue, "#C3E6CB",  // Green for good
   IF(DeptValue > CompanyValue, "#F8D7DA",  // Red for bad
      "#FFF3CD"))  // Yellow for neutral
 
rajendraongole1_0-1743611377305.png

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you very much!

The people on this forum are so helpful.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.