Show a trend in a Power BI card: built in or SVG

Two ways to put a small trend chart inside the Power BI card visual, the Trend axis in preview since November 2026 and an SVG image measure that works today, with the DAX, a worked six-month example whose points add up, a hover variant, and the mistakes that make a sparkline lie.

Short answer: a number on a card says "how much", and a small line under it says "and which way is it going". The card visual can now draw that line itself: the Trend axis (Preview), added in the November 2026 update, puts a trend chart in a card with its own formatting for labels, markers, axes, legends and tooltips. Until it leaves preview, or when you need full control, a measure that returns an SVG image does the same job: set its data category to Image URL and pick it under Format visual, Image, Select from data. The card's image States let a hover image show more detail.

A card that says 171 units this month is not much use alone. 171 after 120 six months ago is a 42.5% climb; 171 after 240 is a slide. The trend under the number tells the reader which story they are in before they ask.

What should the card look like?

Six months of units for one product line, the numbers this post uses all the way through:

050100150200JunJulAugSepOctNov
Units by month, the trend the card should show

On the card, the callout shows 171, a reference label shows "+5.6% vs October" (171 against 162), and the small line underneath shows the climb from 120.

Which way should you build it?

Trend axis (Preview)
  • built into the card
  • format labels, markers, axes, legend and tooltips in the pane
  • no DAX
  • preview, so it can still change
SVG image measure
  • a measure draws the line as an image
  • any look you can write in SVG
  • works in reports today
  • you maintain the DAX
Two ways to put a trend in a card

Use the built-in Trend axis when a preview feature is acceptable in that report and its formatting is enough. Use the SVG measure for a production report that must not change under you, or when you want something the pane does not offer, such as a shaded band for the target range.

How do you write the SVG measure?

The measure takes the last six months up to the latest month in the filter, scales each month's value into a 100 by 40 box, and joins the points into one line. It assumes a Date table with a Month Start column and a [Units] measure.

Units Trend SVG =
VAR LastMonth = MAX ( 'Date'[Month Start] )
VAR Months =
    TOPN (
        6,
        FILTER ( ALL ( 'Date'[Month Start] ), 'Date'[Month Start] <= LastMonth ),
        'Date'[Month Start], DESC
    )
VAR Points =
    ADDCOLUMNS (
        Months,
        "@v",
            VAR M = 'Date'[Month Start]
            RETURN CALCULATE ( [Units], REMOVEFILTERS ( 'Date' ), 'Date'[Month Start] = M ) + 0
    )
VAR Lo = MINX ( Points, [@v] )
VAR Hi = MAXX ( Points, [@v] )
VAR N = COUNTROWS ( Points )
VAR Ranked = ADDCOLUMNS ( Points, "@i", RANKX ( Points, 'Date'[Month Start], , ASC ) )
VAR Line =
    CONCATENATEX (
        Ranked,
        VAR X = DIVIDE ( ( [@i] - 1 ) * 100, N - 1 )
        VAR Y = 36 - DIVIDE ( [@v] - Lo, Hi - Lo ) * 32
        RETURN FORMAT ( X, "0.0" ) & "," & FORMAT ( Y, "0.0" ),
        " ", [@i], ASC
    )
RETURN
    "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40'>"
        & "<polyline fill='none' stroke='%23118DFF' stroke-width='2' points='" & Line & "'/></svg>"

Three details matter. REMOVEFILTERS ( 'Date' ) lets earlier months in, even when a year slicer would cut them off. + 0 turns a month with no sales into a zero instead of a gap. And %23 is the # of the colour, which has to be encoded inside a data URL.

Do the points add up?

The box is 100 wide and 40 high. Six months spread across the width in steps of 100 / 5 = 20. The lowest value (120) sits at y = 36 and the highest (171) at y = 4, so each unit is 32 / 51 of a step:

MonthUnitsxy = 36 - (Units - 120) / 51 * 32
Jun1200.036.0
Jul13520.026.6
Aug12840.031.0
Sep15060.017.2
Oct16280.09.6
Nov171100.04.0
The six points the measure writes, with Lo = 120 and Hi = 171

SVG counts y from the top, so a smaller y is higher on the card: November at 4.0 is the top of the line. If your picture shows the line upside down, the 36 - is missing.

How do you put it on the card?

  1. Select the measure, and in Measure tools set Data category to Image URL.
  2. Select the card, Format visual, Visual, Image. In Apply settings to, pick the card for Units.
  3. Set States to Default, turn Image on, Image source: Select from data, choose Units Trend SVG, Image fit: Fit.
  4. For a richer picture on hover, set States to Hover and pick a second measure, for example the same line with a dot and label on every month.
  5. Repeat per card. With Apply settings to: All, every card gets the same image, which is wrong when each card has its own measure.

What goes wrong?

  • A line that exaggerates. Scaling from the lowest to the highest value makes a 3% wobble look like a cliff. When small moves matter less, scale from zero (Lo = 0) instead.
  • Every card shows the same line. Apply settings to is on All. Choose each card and its own measure.
  • The line stops early. A year slicer filters the Date table; keep REMOVEFILTERS ( 'Date' ) in the measure.
  • An empty image with one month of data. With N = 1 there is no line to draw. Show the image only when two or more months exist.
  • Preview in production. The built-in Trend axis can still change before general availability; keep the SVG measure where a report must stay exactly as it is.
  • Commas as decimals. FORMAT follows the model's culture, and a culture that writes 26,6 breaks the SVG. Give it the locale as a third argument: FORMAT ( X, "0.0", "en-US" ).

Where can you check this?

Where do you start?

Pick the one card readers look at first, add the comparison as a reference label and the six-month line as an image. The card visual in Power BI covers reference labels and layouts, and sparklines in Power BI puts the same kind of line into tables and matrices.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.