Become a Dynamics 365 expert with Syvantis Learn
Provide additional details about the offer you're running.
This store requires javascript to be enabled for some features to work correctly.
Provide additional details about the offer you're running.
How to use conditional formatting in Power BI reports
Power BI & Fabric • Power Platform
This Fast Class explains how to use conditional formatting in Power BI to make report data easier to interpret. You’ll learn how to apply gradients, rules, and field values; use DAX measures for more complex formatting; add dynamic titles and icons; create data bars and hyperlinks; and understand how calculation context affects conditional formatting.
Conditional formatting in Power BI works similarly to conditional formatting in Excel. You can use rules and references to create highlights and gradients or use DAX measures when you need more complex formatting. One important difference is context, which determines where in a visual's data hierarchy a value is calculated. Understanding context is important because the same conditional formatting rule can behave differently depending on whether it's applied to an entire visual or individual values within it.
Finding conditional formatting options
Conditional formatting is managed at the visual level, and each Power BI visual supports different formatting options. When a setting supports conditional formatting, you'll see a function button next to it in the formatting pane. Depending on the setting, Power BI may provide three main formatting styles:
Power BI can also automatically populate fields and summarization options based on the data in your visual.
Creating a color gradient
Gradients provide a simple way to change colors according to values in your data.
For example, you can apply a gradient to a visual's background and base the color intensity on total sales. Set minimum and maximum values and choose the colors you want Power BI to display across that range.
Context is important here. When conditional formatting is applied to a visual's general background, Power BI calculates the value using the data going into the entire visual. Selecting an individual category within the visual doesn't necessarily change that calculation.
Changing which data enters the visual through a filter, however, changes the value being calculated and therefore the formatting.
Applying gradients to individual data points
You can also apply a gradient directly to elements such as the bars in a bar chart.
When formatting multiple data points, Power BI can use the lowest and highest values rather than requiring you to specify static minimum and maximum numbers.
In this case, the context changes. Each category is evaluated relative to the other categories currently displayed. If the highest-selling category is filtered out, the next-highest category becomes the maximum and receives the corresponding gradient color.
Understanding whether Power BI is evaluating an entire visual or individual data points can help explain unexpected conditional formatting behavior.
Using field values for dynamic formatting
Field value formatting provides additional flexibility when built-in gradients and rules aren't enough. For example, a Power BI visual can use a DAX measure to create a dynamic title. The measure can combine text with data such as total sales. When the report is filtered, the measure recalculates and the title updates automatically.
Field values can also control colors. A DAX measure can evaluate your data and return a color only when certain conditions are met. For color formatting, the measure can return a recognized CSS or SVG color name, such as green, or a hex color code beginning with a pound sign. Returning a blank value allows the visual to retain its default color.
Creating more complex formatting with DAX
DAX can support formatting scenarios that would be difficult to create with standard rules.
In the example, a measure checks whether sales for the Accessories category are greater than or equal to sales for Clothing. If Accessories meets that condition, Power BI changes its color to green. Otherwise, the measure returns a blank value and leaves the original color unchanged.
Because the measure recalculates as the report's context changes, filtering by month can reveal when the condition becomes true. This approach gives you granular control over when and how individual data points are highlighted.
Using rules-based conditional formatting
Rules provide another way to display changes and trends visually.
In a matrix, you can apply conditional formatting to individual cells using icons. Power BI includes several icon sets, such as arrows, circles, squares, and triangles. The default rules can divide values into percentage-based ranges, but you can replace these with your own thresholds.
For example, you can create a measure that calculates the percentage change in sales from the previous month. That measure can then control which icon appears beside each month's sales value.
When configuring this type of rule, be mindful of the difference between Percent and Number. Percent evaluates a value relative to the minimum and maximum of a data set. If your measure already returns a percentage, using Number allows your rules to evaluate the actual calculated value instead.
Using measures behind the scenes
A measure doesn't have to be visible in a table or matrix to control conditional formatting.
Once a measure has been assigned to the formatting rule, you can remove it from the displayed fields and continue using its calculated value behind the scenes. This helps keep the report clean while still supporting sophisticated formatting logic.
Adding data bars
Tables and matrices provide additional conditional formatting options, including data bars. Data bars create a small visual representation of a value directly within a cell. You can configure their minimum and maximum values and use different colors for positive and negative results.
For example, applying data bars to a percentage-change measure can make increases and decreases easier to identify without requiring users to read every individual number.
Creating dynamic web links
Power BI can also use conditional formatting to turn values into dynamic hyperlinks.
A DAX measure can construct a URL based on the current data context. You can then apply that measure using the Web URL formatting option.
While a simple example might generate a search based on the selected month, the same technique can create links back to records in a CRM, ERP, or another source system. This can give report users a direct path from analytical information in Power BI to the underlying business record.
Choosing the right conditional formatting approach
Conditional formatting can make important trends, exceptions, and changes easier to spot within a Power BI report.
Gradients are useful for visually comparing values across a range. Rules can categorize values using specific thresholds and icons. Field values and DAX measures provide more control when your formatting depends on custom business logic.
Whichever approach you choose, pay attention to the calculation context. Understanding where Power BI evaluates each value will help ensure your conditional formatting produces the results you expect.
* This transcript summary has been generated from the Fast Class video by Microsoft Copilot. The Fast Class itself was prepared and taught by Syvantis expert consultants.
TUNE INTO THE LIVE CLASS
Ask your questions and get real-time responses from your trusted Syvantis consultants.
What's on the schedule?
Dynamics 365 Business Central
Dynamics 365 Sales (CRM)
Dynamics 365 Customer Insights
Power Platform
Keep learning...
Business Process Designers. Technical Experts. Dedicated Partners.