Power BI Matrix Conditional Formatting + Examples

Do you know applying the Power BI Matrix conditional formatting feature can take our reports to the next level.

Recently, I was working with a Power BI Matrix visual where I found using Power BI Matrix conditional formatting; we can change background color, font color, data bars, icons, and web URLs based on value.

This Power BI tutorial will help you know what conditional formation is in the Power BI Matrix visual and how to apply conditional formatting in the Power BI Matrix visual.

Power BI Matrix Conditional Formatting

  • Conditional formatting in Power BI Matrix Visual is a feature that allows us to change our data based on specified conditions.
  • With conditional formatting in Power BI Matrix Visual, we can highlight data in text or numeric fields by applying color, icons, or data bars.
  • Also, assign URLs to fields to create clickable links and load web pages.

The screenshot below shows Conditional Formation in the Power BI Matrix Visual.

How to Apply Conditional Formatting in the Power BI Matrix Visual

How to Apply Conditional Formatting in Power BI Matrix Visual

Here, we discuss applying conditional formatting in the Power BI matrix visual.

We have a SharePoint list (Finance Sample) that contains below columns with various data types:

ColumnsData Types
SegmentSingle line of text
CountrySingle line of text
ProductSingle line of text
SalesCurrency
ProfitCurrency
Unit SoldNumber
Power BI Conditional Formatting for Matrix

1. Open Power BI Desktop and load the SharePoint list. Then, we can see the data set in the Data Panel.

Apply conditional matrix formatting in Power BI

2. Under the Visualization panel, click Matrix Visual, Then drag Country into Rows, Segment into Columns, and Sales into Values fields.

Power BI Conditional Formatting for Matrix

Now, in the above matrix, let’s apply conditional formatting. With conditional formatting, we can:

  1. Conditional formatting using background color in Power BI Matrix.
  2. Conditional formatting using font color in Power BI Matrix.
  3. Conditional formatting using data bar in Power BI Matrix.
  4. Conditional formatting using icons in Power BI Matrix.
  5. Conditional formatting using web URL in Power BI Matrix.

Conditional Formatting using Background Color in Power BI Matrix

I will tell you how to format cells with color based on a value in the Power BI Matrix visual.

I hope you create the above matrix visual in Power BI Desktop.

1. Select the Matrix visual -> under the Visualization panel, click Format you visual -> click Visual -> expand the Cell elements.

format cells with color based on a value in the Power BI Matrix

2. Next, enable the Background color. Then, you see the cell’s background color automatically format based on value.

Power BI Conditional formatting based on field value

3. We can change the Background color of cells. To do this, expand the Cell elements -> under the Background color, click fx.

Conditional Formatting With Background Color Of Cell In Power BI

4. Then, a Background color dialog box opens. In this box, Gradient means that the lowest value is set to one color and the highest to another. After selecting the color, click OK.

Power BI Matrix conditional formatting rows

5. The cell’s background color changes according to the value.

Conditional Formatting using background color in Power BI Matrix Visual

You can apply Power BI Matrix conditional formatting using background color.

Conditional Formatting using Font Color in Power BI Matrix

I hope you create the above matrix visual in Power BI Desktop. Then, I will tell you how to format the font color based on the Power BI Matrix visual value.

1. Select the Matrix visual -> under the Visualization panel, click Format you visual -> click Visual -> expand the Cell elements ->enable the Font color.

how to format the font color based on the Power BI Matrix visual value

2. After enabling Font color, you see the cell’s font color automatically formatted based on value.

Power BI Conditional Formatting

3. To change font color, expand the Cell elements -> under the Font color, click fx.

conditional formatting in Power BI matrix based on a different text field

4. Then, a Font color dialog box opens. Now, set the Minimum and Maximum color then click OK.

Power BI Matrix conditional formatting totals

5. After clicking ok, The cell’s font color changes according to the value.

Conditional Formatting using Font Color in Power BI Matrix

This way, you can conditional formatting using font color in Power BI Matrix visual.

Conditional Formatting using Data Bar in Power BI Matrix

I hope you create the above matrix visual in Power BI Desktop. Next, in the Power BI Matrix visual, I will tell you how to format cells with bars based on their values.

1. Select the Matrix visual -> under the Visualization panel, click Format you visual -> click Visual -> expand the Cell elements ->enable the Data Bar.

Power BI format cells with bars based on their values

2. After enabling Data bars, you see Data bars give colored bars, like a bar chart, automatically formatted based on their values.

Conditional Formatting with Data Bars in Power BI

3. To change the Data bar color, expand the Cell elements -> Under the Data bar, click fx.

Improving the Data Bar for matrix in Power BI

4. Then, a Data bars dialog box opens. We can set colors for the positive and negative values based on the maximum and minimum values in our data range. Then click OK.

Changing Data Bar Colors based on Conditions in Power Bi

5. The cell’s Data bar color changes according to the values.

Conditional Formatting By Data Bar In Power BI

6. We can only show the Data bar and remove the font. To do this, expand the Cell elements -> Under the Data bar, click fx -> check the Show bar Only check box -> click OK.

Power BI - Add Data Bars to matrix

7. After clicking OK, you see the font text remove only the data bar in the cells.

Conditional Formatting using Data Bar in Power BI Matrix

This way, you can format conditional using the Data Bar in Power BI Matrix.

Conditional Formatting using Icons in Power BI Matrix

Next, in the Power BI Matrix visual, I will tell you how to add icons to cells based on their values. It is also known as KPIs(key performance indicators) in Power BI.

1. Select the Matrix visual -> under the Visualization panel, click Format you visual -> click Visual -> expand the Cell elements ->enable the Icons.

Matrix conditional formatting (with Icons) in power BI

2. We can change the icons. To do this, go to the Cell elements section -> below the Icons, click the fx.

Conditional Formatting Using Icons In Power BI

3. Next, the Icons dialog box opens. In this box, expand the Style box. We can set up 25 different pairs of icons. Check the screenshot below.

Conditional formatting in Power BI: Turn icons On/Off

4. Now, choose one pair icon and click the OK button.

conditional matrix formatting in Power BI

5. Then, you see the icons added to the cells.

Conditional Formatting using Icons in Power BI Matrix

This way, you can apply Power BI Matrix conditional formatting using Icons.

Conditional Formatting using Web URL in Power BI Matrix

Now we see how to give a Web URL in Power BI Matrix.

Now, we can’t give a Web URL in the matrix because we do not have a web URL in the data set, but we can create a measure in this measure we give the web URL.

1. Under the Home tab, click on the New measure.

Conditional Formatting with Web URL in Power BI Matrix Visual

2. In the formula bar, put the below DAX expression. Then click Commit.

Web URL = 
        SWITCH(
                MIN('Financial Sample'[Country]),
                "Canada","https://en.wikipedia.org/wiki/Canada",
                "France","https://en.wikipedia.org/wiki/France",
                "Germany","https://en.wikipedia.org/wiki/Germany",
                "Mexico","https://en.wikipedia.org/wiki/Mexico",
                "United States of America",
                 "https://en.wikipedia.org/wiki/United_States",
                ""
)
Power BI Matrix Conditional Formatting based on Measure

3. Select the Matrix visual -> under the Visualization panel, click Format you visual -> click Visual -> expand the Cell elements ->enable the Web URL.

Conditional Formatting By Web URL In Power BI

4. After enabling Web URL. A dialog(Web URL) box comes. Here, choose the measure in the What field should we base this on? Section. Then click OK.

Add hyperlinks URL to a matrix - Power BI

5. Then you see in the cells the web URL shown.

Conditional Formatting using Web URL in Power BI Matrix

This way, you can apply conditional formatting using the Web URL in the Power BI Matrix

Conclusion

I hope this tutorial helps you a lot. This tutorial taught us what conditional formatting is in the Power BI Matrix visual and how to apply conditional formatting in the Power BI Matrix visual.

In this tutorial, I also provided guidance on applying conditional formatting in the Power BI Matrix Visual using background color, font color, data bars, icons, and web URLs.

Also, you may like some more Power BI tutorials: