Partager via


Power BI - Using the Treemap Visual with KPI status colors (red, yellow, green)

Using the Treemap Visual with KPI status colors (red, yellow, green)

"Is possible to modify the default colors of the Treemap visual to reflect red/yellow/green status based upon a status field value?"

This question was asked yesterday in a customer demo, and I didn’t know the answer off the top of my head. As it turns out, it is relatively simple to do. The hardest part of this task is probably in getting the audience to agree upon the colors used.

The .pbix file can be downloaded from here to try it out yourself.

 

Power BI Treemap
In this example, we have the following data:

  • Task name
  • Task value (1-100 scale with 100 being the highest priority)
  • Status (1 = On Track, 2 = Warning, 3 = At Risk)

In the default treemap, we set the Group field to the Task column and the Value field to the Task Value column to build a simple treemap.

 

Power BI Treemap Power BI Treemap

To add KPI colors, set the Color Saturation field to the Status column value. This defaults to using a color scale based on the value in the Color Saturation field, which is useful if you have a broad range of status values (ex: 1-10 status, with darker colors representing a more at-risk status).

Power BI Treemap    Power BI Treemap

In our case, we only want three colors displayed with the classic traffic light color scheme to represent status. To make this change, select the treemap, and in the format pane, set data colors -> diverging to On. This will display minimum, center, and maximum, which we will set to the colors red, yellow, and green. For this sample, I used the following hex values:

Red – FF5468
Yellow – FABE4D
Green – 46C645

To update the color (ex: to make Minimum red), select the drop down for the color, click on Custom Color, and enter the hex value or select from the color palette. Once you set the values for each of the three color, your treemap will display the status colors instead of the default color scheme.

 

Power BI Treemap  Power BI Treemap

 

Thanks,
Sam Lester (MSFT)

Comments

  • Anonymous
    April 01, 2017
    Nice.I try KPI by Treemap for my reports.