Forum Discussion

Fusilier2's avatar
Fusilier2
Helper V
1 year ago
Solved

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])

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

     

    Hope this helps.

     

  • Fusilier2's avatar
    Fusilier2
    1 year ago

    Thank you very much!

    The people on this forum are so helpful.

2 Replies

  • 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
     

     

    Hope this helps.

     

    • Fusilier2's avatar
      Fusilier2
      Helper V

      Thank you very much!

      The people on this forum are so helpful.