DAX patterns
Power BI SVG measures
data:image/svg+xml, set to the Image URL data category. These 17 patterns cover the charts people most often squeeze into a table cell or a card, each with the full DAX, a preview rendered from that DAX, and the gotchas.By Nawaf Sharaf · Founder & Reliability Engineer · Updated
Trend
Sparkline (line)A word-sized line chart per row: the shape of the trend without axes, built from CONCATENATEX over the date axis.series · 405 chars for the sample
Sparkline (area)A filled sparkline with an optional zero baseline and a line that turns green or red with the direction of the period.series · 613 chars for the sample
Column sparkline (small multiple bars)Tiny columns per period with the latest or the highest period highlighted: better than a line when periods are discrete.series · 924 chars for the sample
Win/loss barsEqual-height up and down ticks per period: shows streaks of beating or missing a goal, not the size of the miss.series · 912 chars for the sample
Progress to target
Bullet chartActual as a bar, target as a tick, and poor/satisfactory/good bands behind: Stephen Few's gauge replacement in one table cell.scalar · 492 chars for the sample
Progress barA percent-complete bar with an optional label and red/amber/green thresholds, from one ratio measure.scalar · 415 chars for the sample
Progress ringA circular percent-complete ring with the value in the middle, sized for a table row or a Card visual image.scalar · 529 chars for the sample
Data bar with targetA bar per row on one shared scale with a target tick and the value printed: conditional-formatting data bars that know the goal.scaled · 387 chars for the sample
Status
KPI arrow / delta badgeAn up or down arrow with the % change against a comparison measure, coloured by whether the change is good.scalar · 428 chars for the sample
Traffic light / RAG dotA red, amber or green status from two thresholds: a single dot, a ring, or a three-lamp traffic light that also reads in greyscale.scalar · 159 chars for the sample
Status pillA tinted pill with a word (On track, At risk, Off track) chosen by thresholds: the status column every project table needs.scalar · 428 chars for the sample
Rating starsCustomer or quality ratings as stars with exact partial fill (3.7 fills 3.7 stars), clipped with a nested SVG instead of rounding.scalar · 1,031 chars for the sample
Icon + valueOne of the Design Studio's line icons in a tinted circle next to the formatted value, with the icon colour driven by a threshold if you want.scalar · 680 chars for the sample
Comparison
Variance bar (IBCS style)Actual minus plan as a green or red bar from a shared zero axis, or the relative variance as an IBCS pin, with the signed value printed.scaled · 390 chars for the sample
Dumbbell (before / after)Two dots joined by a line per row (last year and this year, plan and actual) on one shared scale: the change and the level at once.scaled · 313 chars for the sample
Composition
KPI card
Scalar, series and scaled measures
The pattern's shape decides where it can go and what it costs to evaluate.
| Shape | How it's computed | Where it works |
|---|---|---|
| Scalar | One value per row (or per card): progress bar, ring, bullet, RAG, delta badge, pill, stars, icon, donut. Cheapest to evaluate. | Table, matrix, new Card visual (image or callout image) |
| Series | Iterates an axis with CONCATENATEX to draw a trend inside each row: sparklines, column sparkline, win/loss, KPI card. | Table or matrix with a category on rows; Card visual (whole trend) |
| Scaled | Reads every visible row once (ALLSELECTED over the row column) so all rows share a scale: data bars, variance bars, dumbbells. | Table or matrix, with the named column on rows |
When an SVG measure isn't enough
Questions
Are SVG measures supported by Microsoft?
Image URL is a documented data category, and Microsoft Learn's own Card visual tutorial builds SVG images with DAX measures and a user-defined function. The SVG markup inside is yours, so test it like any other measure.
Should I use the built-in sparklines or an SVG measure?
Built-in table sparklines need no DAX and are the simplest choice for a plain line or column trend. Choose an SVG measure when you need markers, targets, thresholds, colours by direction, or the same picture in a Card visual.
Do SVG measures slow reports down?
Each one is a measure evaluated per visible row, and series patterns also iterate the axis. A dozen periods across a screen of rows is fine; thousands of rows with three-year daily series is not. Filter or TOPN the table, and coarsen the axis.