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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lkshck
Helper III
Helper III

Percentage of Total with Stacked Bar Chart

Hey, I would like to create a Stacked Bar Chart showing in total 100% values and it can be grouped by several categories. I saw it in the following video:

https://www.youtube.com/watch?v=-nqEv2YXLsU

I got it running for one specfic category with the following measure:

Cost % of Total = DIVIDE (
    [Cost Amount],
    CALCULATE ( SUM ( 'Usage details'[Cost] ), ALLEXCEPT ( 'Usage details', 'Usage details'[MeterCategory] ) )
)

But now having the Parameter slicers where I can switch the categories to something else, this solution doesn't work anymore. Is there any way to keep the Stacked bar chart with at the end 100% as total value but with different grouping from other fields in the table 'Usage details'?

1 REPLY 1
amitchandak
Super User
Super User

@lkshck , Switch measure based on selection

refer the code here , i switched it for topn

Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.