← ClaudeAtlas

pbir-conditional-formattinglisted

Use when adding conditional formatting to a Power BI visual — per-point bar/column colors, diverging gradients, line segment colors, marker transparency, data bars, conditional icons. Three approaches — measure-based (extension measure dataType Text returning theme tokens good/bad/neutral/minColor/midColor/maxColor), FillRule linearGradient2/linearGradient3, rule-based Conditional.Cases. Plus dataViewWildcard selector with matchingOption 1 for per-point, required two-entry array pattern for dataPoint/lineStyles/error, extension measures attaching to EXISTING semantic-model entities via reportExtensions.json, Schema extension on report-level measures, line segment limits (single-series only, segmentGradient affects strokeColor only), marker color/shape/size NOT CF-able (use transparency), ComparisonKind codes 0-4, ScopedEval + AllRolesRef for global min/max. Invoke when user colors bars by a measure, fixes same-color-on-all-points, adds a gradient, data bars, or conditional icons.
wardawgmalvicious/claude-config · ★ 1 · Data & Documents · score 75
Install: claude install-skill wardawgmalvicious/claude-config
## PBIR Conditional Formatting Reference Three approaches: measure-based (flexible), `FillRule` gradients (no DAX), and rule-based `Conditional` (UI-generated). ### Approach Matrix | Approach | Best For | Pros | Cons | |---|---|---|---| | Measure-based | Custom logic, theme colors | Full DAX, readable | Requires extension measure | | `linearGradient2` / `linearGradient3` | Color scales | No DAX | Gradients only | | `Conditional.Cases` | UI-portable rules | Power BI UI round-trips | Verbose | ### Supported Properties Not every property accepts measure expressions. These do: `fill`, `borderColor`, `defaultColor`, `fontColor`, `color`, `backgroundColor`, `lineColor`, `markerColor`, `strokeColor`, `text`, `titleText`, `fontSize`, `strokeWidth`, `weight`, `transparency`, `radius`, `url`, `good`, `bad`, `neutral`, `target`, `icon` Everything else is literal-only or `ThemeDataColor`. ### dataViewWildcard Selector The key to per-point formatting. | `matchingOption` | Behavior | |---|---| | `0` | Identities + totals (series-level) | | `1` | Per data point (most common for CF) | | `2` | Totals only | ```json "selector": {"data": [{"dataViewWildcard": {"matchingOption": 1}}]} ``` Wrong for per-point: `"selector": {"metadata": "Sales.Revenue"}` — evaluates once per series. ### Two-Entry Array Pattern (Required) `dataPoint`, `lineStyles`, `error` require a two-entry array: base entry + conditional entry. ```json "dataPoint": [ {"properties": {}}, { "properties": {