Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
PrakashPalle
Helper II
Helper II

Sparkline with Legend Present

Hi All, I’m trying to create a sparkline in a matrix visual that already has a legend. When I add a sparkline for the metric, it creates an extra column for each year-month instead of a single sparkline column. I’d like to have just one column for the sparkline. Could you please advise how to achieve this?

Actual: 

PrakashPalle_0-1760701804850.png

Expected: 

PrakashPalle_1-1760701875530.png

 

1 ACCEPTED SOLUTION

could you share your pbix-file?

View solution in original post

9 REPLIES 9
v-echaithra
Community Support
Community Support

Hi @PrakashPalle ,

If the issue still persists, we kindly request you to share the sample data in a workable format such as text, an Excel file, or a PBIX file with sample data instead of screenshots. Additionally, please include the expected output. This will enable us to assist you more effectively.

 

Best regards.

v-echaithra
Community Support
Community Support

Hi  @PrakashPalle ,

If possible, could you please provide more details about your data?

How to provide sample data in the Power BI Forum

You can refer the following link to upload the file to the community.
How to upload PBI in Community

Thank you.

 

Ahmedx
Super User
Super User

pls try! I created this using SVG.

Screenshot_2.png

Hi @Ahmedx , Thanks for the reply. I replicated your solution. Not worked for me.

PrakashPalle_0-1760721879172.png

 

You still need to change the DATA Category
Screenshot_7.png

I converted the data category. Still the same. 

PrakashPalle_0-1760887366816.png

 

could you share your pbix-file?

johnbasha33
Super User
Super User

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

  1. Keep only your measure (Sum of Actual) in Values.

  2. Remove yr_mon2 from Columns.

  3. Add a sparkline to Sum of Actual → set the X-axis field to yr_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 !!








rohit1991
Super User
Super User

Hi @PrakashPalle 

 

This happens because Power BI sparklines depend on how your matrix is grouped. When your matrix already has a legend or separate fields like Year and Month in the columns, Power BI treats each of those combinations as a unique series. That’s why it ends up drawing multiple sparkline columns instead of just one. To get a single sparkline, try removing the legend or move it to the rows section so that all data rolls up together. Another good approach is to create a combined “Year-Month” column in your data model and use that for the sparkline’s axis , this helps Power BI recognize it as one continuous timeline. You can also make sure that your measure (like Actual or Sales) is used consistently without being split by multiple fields. Once you simplify the column grouping to one field, the matrix will automatically show a single, clean sparkline column per metric. It’s just how Power BI handles grouping logic internally.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.