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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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