Forum Discussion
Sparkline with Legend Present
- 10 months ago
could you share your pbix-file?
Hi PrakashPalle
In Power BI, the behavior you’re seeing happens because the sparkline feature in a matrix is tied to the column hierarchy—each field in Columns (like yr_mon2) generates its own sparkline column.
If you already have a legend or multiple measures, Power BI treats every combination of measure × column field as a separate sparkline slot.
To show only one sparkline column per metric, you have two solid options:
Option 1 – Create a single “Month” trend measure for sparklines
Instead of plotting [Actual] per yr_mon2 column directly, create one trend measure that summarizes across the months in scope.
Actual Sparkline :=
VAR TrendTable =
ADDCOLUMNS (
VALUES ( 'DateTable'[yr_mon2] ),
"@Actual", [Actual]
)
RETURN
SUMMARIZE ( TrendTable, 'DateTable'[yr_mon2], "@Actual", [Actual] )
Then use Actual Sparkline as the sparkline field while keeping only one “Sum of Actual” column in your matrix.
Remove yr_mon2 from the Columns well so you don’t create repeated groups—Power BI will still draw the line by month behind the scenes.
Option 2 – Move yr_mon2 to the sparkline setup instead of Columns
-
Keep only your measure (
Sum of Actual) in Values. -
Remove
yr_mon2from Columns. -
Add a sparkline to
Sum of Actual→ set the X-axis field toyr_mon2.
Now the matrix shows one “Sum of Actual” column and one sparkline column summarizing the trend over all months, instead of one sparkline per month.
Option 3 – If you need a legend
When you also have a legend or multiple series (e.g., “Actual vs Plan”), pivot the legend to Values and use only one date field (yr_mon2) in the sparkline X-axis.
Power BI currently doesn’t support multi-series sparklines in a single cell, so the legend has to stay out of Columns.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!