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

Conditional formatting allows you to visually highlight or format certain data based on a set of conditions. In Power BI, you can apply conditional formatting to a text column by selecting the desired column and then using the “Conditional formatting” option in the “Format” tab. From there, you can choose the conditions and format you want to apply, such as changing the font color or adding a background color, to specific values or ranges of values in the text column. This can help you identify important or relevant data and make it stand out in your visualizations.


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