Power BI Blog: Conditional Formatting Based upon String Fields
16 March 2023
Welcome back to this week’s edition of the Power BI blog series. This week, we look at a new addition to conditional formatting.
Just recently, conditional formatting rules have now been made available based upon string fields. You may access this new capability in the same way as all other conditional formatting: through the dialog which opens up from selecting an option in the Formatting pane. For example, in column charts, you can conditionally format column colours by selecting the fx button in the Columns card of the Formatting pane, viz.
In the dialog, select ‘Rules’ through the ‘Format style’ dropdown, then base these rules upon a string field and select a summarisation. Before, your summarisation options were only ever numerical, e.g. Count and Count (Distinct). Now you’ll see First and Last options as well, which will give you strings to write logic around.
In the example below, we add a simple rule to check that the value of the string is Audio, and if it is, we wish to colour the column red:
Then press OK, and the Audio columns of the visual will now be coloured red:
Power BI has added a variety of comparator options to the ‘Conditional formatting’ dialog, including ‘is’, ‘starts with’, ‘ends with’ and more. Do keep in mind that these comparisons will check your fields against your inputs for exact character matches, including case-sensitivity.