How do I apply conditional formatting to a text column in Power BI?

Conditional formatting is a powerful feature in Power BI that allows users to visually highlight data based on specified conditions. In order to apply conditional formatting to a text column in Power BI, users must follow a few simple steps. First, they must select the desired text column in their data set. Then, they can access the “Format” tab and click on “Conditional formatting.” From there, users can specify the conditions they want to apply and choose the formatting options such as color, font, and style. This will automatically highlight the text in the selected column based on the defined conditions, making it easier for users to identify important data points. Overall, applying conditional formatting to a text column in Power BI is a straightforward process that can greatly enhance the visual presentation and analysis of data.

Power BI: Apply Conditional Formatting to Text Column


Often you may want to apply conditional formatting to strings in a text column in Power BI, such as the following:

Power BI conditional formatting based on text

Fortunately this is easy to do and the following step-by-step example shows how to do so.

Step 1: Import the Data

First, we will import the following dataset into Power BI that contains information about various basketball players:

Step 2: Create New Column

Suppose that we would like to apply conditional formatting to the values in the Team column.

Before we can do so, we must first create a new column with numeric values that correspond to each of the values in the Team column.

To do so, click the Table tools tab, then click the New column icon:

Then type the following formula into the formula bar:

New = SWITCH(
            'my_data'[Team],
            "A", 1,
            "B", 2,
            "C", 3,
            4
            )

This will create a new column named New that contains numeric values that correspond to the text values in the Team column:

Step 3: Insert Table

Next, navigate to the Report View in Power BI and insert the following table:

Step 4: Apply Conditional Formatting to Text Column

To apply conditional formatting to the values in the Team column, click the dropdown arrow next to Team under the Columns label, then hover over Conditional formatting, then click Background color:

In the new window that appears, choose New for What field should we base this on? and then choose Minimum for Summarization, then create four rules that specify what colors to use for each numeric value in the New column:

Once you click OK, conditional formatting will be applied to each of the strings in the Team column:

Power BI conditional formatting based on text

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

x