Power BI Conditional Formatting
Conditional formatting changes the look of a number based on its value. Cells turn red when sales fall short and green when targets are met. Readers spot patterns without reading each figure.
The Traffic Light Analogy
A traffic light communicates with color. Red means stop, yellow means slow down, and green means go. Drivers understand instantly and never read a sign. Conditional formatting brings this signal to a report.
Value Color below 50 RED (stop and check) 50 to 80 YELLOW (watch closely) above 80 GREEN (all good)
Where to Apply It
Tables, matrices, cards, bar charts, and column charts support conditional formatting. Open the Format pane, find the element to style, and click the fx button beside it. A dialog opens with the formatting options.
Formatting Styles
Background Color
The whole cell fills with color. This style creates a heat map effect inside a matrix.
Font Color
Only the text changes color. This style keeps the layout calm and suits dense tables.
Data Bars
A horizontal bar grows inside each cell in proportion to the value. Readers compare magnitudes while reading numbers.
Icons
Arrows, flags, and shapes sit beside a value. A green up arrow marks growth, and a red down arrow marks decline.
Web URL
A column can turn into clickable links, which suits product pages or support tickets.
Format Style Options
| Option | How It Works | Best For |
|---|---|---|
| Gradient | Colors blend from low to high | Heat maps |
| Rules | Fixed ranges with chosen colors | Targets and thresholds |
| Field value | A column or measure supplies the color code | Full control |
Building a Rules-Based Format
- Select the visual and open the Format pane.
- Expand Cell elements and switch on Background color.
- Click the fx button.
- Choose Rules from the Format style list.
- Add a rule such as if value is greater than or equal to 80, then green.
- Add further rules for yellow and red ranges.
- Select OK.
Using a Measure for Color
Field value formatting gives complete control. A DAX measure returns a color code, and the visual reads it:
Status Color =
IF([Total Revenue] >= [Target], "#2E7D32", "#C62828")Select Field value in the Format style list and pick the Status Color measure. Green appears when revenue meets the target, and red appears when it misses. Update the target, and the colors adjust with it.
Worked Example: Store Performance Matrix
A retail chain builds a matrix with Store in Rows and Month in Columns. The Values well holds Sales versus Target percentage. Rules color the cells: below 90 percent red, 90 to 100 percent yellow, and above 100 percent green.
Store Jan Feb Mar Delhi [G] [G] [Y] Mumbai [Y] [R] [R] Chennai [G] [Y] [G]
The regional manager spots the problem in Mumbai within seconds and calls the store head.
Accessibility Tips
- Combine color with icons or text, since some readers cannot tell red from green.
- Choose strong contrast between cell color and text color.
- Use a small, consistent palette across all pages.
- Avoid more than three colors in one visual.
Key Points
- Conditional formatting colors values based on rules, gradients, or measures.
- Background color, font color, data bars, and icons all work in tables and matrices.
- The fx button opens the formatting dialog.
- A DAX measure can supply color codes for full control.
- Pair colors with icons for readers who see color differently.
