What it does
Conditional formatting now drives the colour of chart lines, line segments, markers and legend entries, not just the fill on bars and columns. You can colour a line by a gradient, by rules, or by a field value (a measure returning a hex code, colour name or theme colour), and keep category colours consistent across every visual on the page.
Key facts
- Works on line, area and combo visuals for line colour, individual line segments, and markers, plus legend colours across supported chart types.
- Three format styles: gradient (needs a numeric field), rules (bands over a numeric field), and field value (a text field or measure returning a colour name, hex code or theme colour name).
- Field-value formatting lets a measure decide the colour, so the same DAX logic can colour every visual identically — the standard way to lock category colours report-wide.
- Available in Power BI Desktop and the service (edit access to the report/semantic model).
- Microsoft's documented examples ship as a TMDL script; createOrReplace overwrites any table sharing a name, so apply it to a blank file, not a live model.
When to use / skip
Use field-value formatting when a category must be the same colour everywhere — it beats hand-picking data colours per visual and never drifts out of sync. Use gradient or rules to make a single line respond to its own values (segment a trend by threshold, flag out-of-range points). Skip it for static, one-off charts where a fixed palette is quicker; conditional formatting is worth the setup only when the colour has to mean something or stay consistent.
Configuration decisions
- Which style fits: gradient for continuous emphasis, rules for banded thresholds, field value for deterministic category or status colours.
- Where the colour comes from: a raw numeric column, or a measure — a measure is more work but far more reusable.
- Whether to standardise on a single colour measure per category and reuse it across visuals, versus formatting each visual independently.
Gotchas
- Field-value formatting is only as reliable as the string it returns — an invalid hex or an unrecognised theme colour name silently falls back and the point loses its colour.
- The sample TMDL uses createOrReplace; run it against a real model by accident and it clobbers same-named tables. Read the warning before pasting.
- Legend and line colours are separate format targets — setting one doesn't set the other, so a "coloured" line can still show a default legend swatch.
- Consistency across visuals only holds if every visual points at the same measure; copy a visual and repoint its data and the colours quietly diverge.
Consultant notes
- The recurring client ask is "make [Region A] always blue" across a report. Field-value formatting driven by one shared measure is the answer — build the colour measure once, apply it everywhere, and it survives new visuals. Teams that set data colours by hand end up with the same category in three different colours across pages.
- Watch for hard-coded hex strings scattered through many measures. Centralise the colour map (a small mapping table or a single SWITCH measure) so a rebrand is one edit, not fifty.
- In UAT people expect the legend to recolour when the line does — flag early that legend colour is its own setting, or you'll field "the line's right but the key is wrong" bugs.
- The TMDL sample is a handy way to demo this to a client quickly, but never run it against their production model to "show them" — spin up a blank file.
Worth revisiting after the next Desktop monthly update in case more visual types gain line/legend conditional formatting.