Skip to content

DAX SVG measures for Power BI

Draw progress bars, bullets, sparklines and KPI badges inside a Power BI table, with a DAX measure instead of a custom visual.

Chart

Value as a share of target; turns the good color once the target is met.

Model

Size

Color and text

Preview

In a Power BI table with sample data.

ProductSalesTargetSales Progress SVG
Product A85100
Product B112100
Product C6480

DAX measure

Create a new measure and paste this in. Under Measure tools, set Data category to Image URL.

Sales Progress SVG =
VAR _v = [Sales]
VAR _t = [Target]
VAR _p = DIVIDE ( _v, _t )
VAR _c = IF ( _p >= 1, "%231AAB40", "%23118DFF" )
VAR _w = MIN ( MAX ( _p, 0 ), 1 ) * 120
VAR _svg =
    "<svg xmlns='http://www.w3.org/2000/svg' width='160' height='22' viewBox='0 0 160 22'>"
        & "<rect x='0' y='6.5' width='120' height='9' rx='4.5' fill='%23E6E8EF'/>"
        & "<rect x='0' y='6.5' width='" & FORMAT ( _w, "0.0", "en-US" ) & "' height='9' rx='4.5' fill='" & _c & "'/>"
        & "<text x='126' y='11' dominant-baseline='middle' font-size='11' font-weight='400' font-family='Segoe UI, sans-serif' fill='%23252423'>" & FORMAT ( _p * 100, "0", "en-US" ) & "%25</text>"
        & "</svg>"
RETURN
    IF ( NOT ISBLANK ( _p ), "data:image/svg+xml;utf8," & _svg )
  1. Power BI Desktop → Home → New measure; paste the DAX.
  2. Measure tools → Data category → Image URL.
  3. Add the measure to a table or matrix; set its size under Format → Image size (width 160, height 22).

One setting makes this work

  1. Home → New measure, then paste what you copied.
  2. Measure tools → Data category → Image URL. Without this the measure shows raw text.
  3. Add the measure to a table or matrix and set Format → Image size to the width and height you chose.

You'll only see this once.

Sparklines, bullets and KPI badges

The progress bar is free and yours to keep. An account adds the other three chart types, saves your measures in a library and fills the colors from your brand.

Create a free account →Free plan, no card.

What people use it for

A table that shows, not just tells

Sales against target as a bar in the row itself, so nobody has to compare two numbers in their head.

Trend per row

A sparkline next to each product, drawn from your date column — the small chart a matrix has never had.

Locked-down tenants

It is a measure, not a visual. Where custom visuals are blocked, this still works.

Which plan includes it

Free
Preview only; copy on Pro
Pro
Full access
Team
Full access

One subscription covers every tool — you do not pay per tool.

Pricing

FAQ

How does an image end up in a table cell?

The measure returns an SVG data URI, and you set the measure's data category to Image URL. Power BI renders it.

Will it work in a published report and in Power BI Service?

Yes — it is a measure like any other, so it travels with the report.

Which chart is free?

The progress bar on this page, in full, without an account. Bullets, sparklines and KPI badges come with a plan.

The other tools

Get the other chart types

Free plan, no card. Everything you make is a standard Power BI file and stays yours.

Start free