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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
telesforo1969
Resolver I
Resolver I

add detail in totals in bar graph when I use leyend

It is possible to add details to the total when I have a variable in the legend ?. The graph shows an error when I use the created measure on the Y axis. If I don't add a legend, I can see the details of my measure.

adddetalles.JPG

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @telesforo1969 

It’s not possible to achieve the result you’re looking for using a stacked bar chart with a legend, because Power BI doesn’t allow customizing the label shown in the total bar when a legend splits the values. The total is computed as a separate aggregation, and you can’t format or add detail to its label in that context.

However, you can simulate the desired result by creating separate measures for each category you want to show in the stacked bar. Then, create another measure that represents the total value, but assign it a small portion of the bar (e.g., the remaining value) and color it white or transparent—this way, it doesn’t visually interfere, but the label still shows up at the total level.
Something like :

Ritaf1983_0-1749091684129.png

The pbix is also attached.

That said, from a data visualization perspective, the current chart has some serious issues:

  1. Stacked bar charts are designed to represent parts of a whole. When you use them for absolute comparisons, it can mislead the reader—since the height of each segment isn’t always easy to compare, especially across categories.

  2. You display percentages, but they don’t add up to 100%, which creates confusion and reduces trust in the data.

  3. The chart has a heavy cognitive load—there are so many labels and numbers that it’s hard to focus on the actual data trends.

I highly recommend reconsidering the visual. A better approach would be to use small multiples (e.g., a separate bar for each category and period). Decide whether the absolute value or the percentage is more important to show directly on the chart, and move the less important value (e.g., the secondary one) to the tooltip. That would make the message much clearer, like in the image I’ve attached.

Ritaf1983_1-1749092174094.pngRitaf1983_2-1749092226038.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Hi @telesforo1969,

Using two stacked charts layered on top of each other is a creative workaround, but you're right it's not the ideal or stable solution. It can easily break with filters, resizing, or interactions, since Power BI doesn't support syncing between two separate visuals like that.

A better approach would be to stick with a single stacked column chart for the actual visual breakdown, and then use a separate measure to display your total with the delta % above it.

You can do that by first use your standard stacked column chart to show the breakdown by category. Then create a DAX measure that combines the total and the offset % into one label.

DAX:

DisplayValue =
VAR Total = SUM(Datos[Valor])
VAR Delta = [Offset_%]
RETURN FORMAT(Total, "#,##0") & " | " & FORMAT(Delta, "+0.00%;-0.00%;0.00%")

Then add a card or multi-row card above your chart and show this DisplayValue measure.

 

This keeps everything dynamic and avoids having to align two visuals manually. If you're open to custom visuals, Zebra BI or Deneb would give you full control over label placements and formatting.

 

Best Regards,

Hammad.

View solution in original post

11 REPLIES 11
v-mdharahman
Community Support
Community Support

Hi @telesforo1969,

Thanks for reaching out to the Microsoft fabric community forum.

It seems you want to add details in a variable in legend of Bar chart visual. As @Ritaf1983 and @maruthisp both responded to your query, kindly go through their responses and check if the responses solves your issue.

 

I would also take a moment to thank @Ritaf1983 and @maruthisp, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

Thank you very much, I added a Zebra graphic that I need to replicate with the free objects. I know I have an error with the bar chart, but I can't add a legend.

Zebra gráfica barras.JPG

réplica de Zebra.JPG
 
For the moment I have it solved in the following way, two stacked graphs, but this is not correct, I think

Hi @telesforo1969,

Using two stacked charts layered on top of each other is a creative workaround, but you're right it's not the ideal or stable solution. It can easily break with filters, resizing, or interactions, since Power BI doesn't support syncing between two separate visuals like that.

A better approach would be to stick with a single stacked column chart for the actual visual breakdown, and then use a separate measure to display your total with the delta % above it.

You can do that by first use your standard stacked column chart to show the breakdown by category. Then create a DAX measure that combines the total and the offset % into one label.

DAX:

DisplayValue =
VAR Total = SUM(Datos[Valor])
VAR Delta = [Offset_%]
RETURN FORMAT(Total, "#,##0") & " | " & FORMAT(Delta, "+0.00%;-0.00%;0.00%")

Then add a card or multi-row card above your chart and show this DisplayValue measure.

 

This keeps everything dynamic and avoids having to align two visuals manually. If you're open to custom visuals, Zebra BI or Deneb would give you full control over label placements and formatting.

 

Best Regards,

Hammad.

Hi @telesforo1969,

As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.

If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.


If so, it would be really helpful for the community if you could mark the answer that helped you the most. If you're still looking for guidance, feel free to give us an update, we’re here for you!

Hi @telesforo1969,
I just wanted to follow up on your thread. If the issue is resolved, it would be great if you could mark the solution so other community members facing similar issues can benefit too.
If not, don’t hesitate to reach out, we’re happy to keep working with you on this. 

 

Best Regards,

Hammad.

Hi @telesforo1969,
I wanted to quickly follow up on your issue. Was your issue resolved in the end?
If yes, it’d be great if you could share a quick update and accept a solution, so other users can benefit from your experience too.
If you’re still stuck, let us know, we’re more than happy to continue helping you through it.

 

Best Regards,

Hammad.

Ritaf1983
Super User
Super User

Hi @telesforo1969 

It’s not possible to achieve the result you’re looking for using a stacked bar chart with a legend, because Power BI doesn’t allow customizing the label shown in the total bar when a legend splits the values. The total is computed as a separate aggregation, and you can’t format or add detail to its label in that context.

However, you can simulate the desired result by creating separate measures for each category you want to show in the stacked bar. Then, create another measure that represents the total value, but assign it a small portion of the bar (e.g., the remaining value) and color it white or transparent—this way, it doesn’t visually interfere, but the label still shows up at the total level.
Something like :

Ritaf1983_0-1749091684129.png

The pbix is also attached.

That said, from a data visualization perspective, the current chart has some serious issues:

  1. Stacked bar charts are designed to represent parts of a whole. When you use them for absolute comparisons, it can mislead the reader—since the height of each segment isn’t always easy to compare, especially across categories.

  2. You display percentages, but they don’t add up to 100%, which creates confusion and reduces trust in the data.

  3. The chart has a heavy cognitive load—there are so many labels and numbers that it’s hard to focus on the actual data trends.

I highly recommend reconsidering the visual. A better approach would be to use small multiples (e.g., a separate bar for each category and period). Decide whether the absolute value or the percentage is more important to show directly on the chart, and move the less important value (e.g., the secondary one) to the tooltip. That would make the message much clearer, like in the image I’ve attached.

Ritaf1983_1-1749092174094.pngRitaf1983_2-1749092226038.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thank you very much but it's not exactly what I need.

maruthisp
Super User
Super User

Hi telesforo1969,

As per my understanding, When using a legend in a bar chart, Power BI splits the measure by category, making it difficult to display a total value across all categories.
Try below steps might help you.

  1. Stacked Column Chart + Total Line - Use a combo chart (Line and Clustered Column).

  2. Tooltip or Card Visual - Show the total in a separate card or tooltip visual for clarity.

  3. Custom Visuals - May be try custom visual might help

  4. Add Total as a Separate Series - Create a measure that repeats the total across all categories and add it as a line series.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X



There is no problem with not seeing information from very thin bars, the problem is that I cannot add more information to the total (a percentage difference for example) in a bar chart when I use the legend.  I need to replicate the image, but with free objects.

Zebra gráfica barras.JPG

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.