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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Totals do not add to 100% in clustered bar chart

Hi Power BI Experts,

 

For readability, i am showing two out of six bar charts in the graph below. The issue is that the bars do not add up to 100% in its respective category. For example, Dashboards NOW equals ~16%.

 

I am using this DAX code to calculate the percentage.

Before and After % of Row Total = COUNT('Before and After'[Progress Rating])/CALCULATE(count('Before and After'[Progress Rating]), ALL('Before and After'))

 

 

quipmaster_0-1664374813611.png

 

I would like for each bar chart to look like this.

 

quipmaster_1-1664375091337.png

 

If I add more than one category, the percent is the grand total of both graphs and that is not what I want.

 

quipmaster_2-1664375154685.png

 

Any help is greatly appreciated.

 

Luis

 

 

1 ACCEPTED SOLUTION

Hmm. That seems strange to me but it's often hard to debug just by looking at screenshots.

 

Here's a variation that might be slightly more robust:

Before and After % of Row Total =
COUNT ( 'Before and After'[Progress Rating] )
    / CALCULATE (
        COUNT ( 'Before and After'[Progress Rating] ),
        ALL ( 'Before and After' ),
        VALUES ( 'Before and After'[Progress Category] )
    )

This removes all filters on that table then restores the category filter. Try ALLSELECTED instead of ALL if you want to want to preserve filters from outside the visual other than category.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Success!

 

Thank you.

 

Which book or course did you get your DAX skills?

 

I would like to upskill my DAX proficiency.

 

Thank you for all of your guidance.

 

quipmaster_0-1664416024226.png

 

I've acquired my DAX skills through years of answering questions like yours and reading articles on sqlbi.com and radacad.com. Both of those sites have training videos too and I have done some of the SQLBI Courses.

AlexisOlson
Super User
Super User

Using ALL, removes all the filter context on the table but you only want to remove part of it.

 

Try just removing the filter context for the Legend field:

Before and After % of Row Total =
COUNT ( 'Before and After'[Progress Rating] )
    / CALCULATE (
        COUNT ( 'Before and After'[Progress Rating] ),
        ALL ( 'Before and After'[Progress Rating] )
    )

 

Anonymous
Not applicable

Thank you Alexis,

 

I am getting closer. Using the DAX, the bars stretch out to 100% by rating category. However, I would like a percentage for each rating category. All the bars for the respective category would sum up to 100% like the built-in function. 

 

Would you mind providing another friendly nudge?

 

quipmaster_0-1664402455014.png

 

Hmm. That seems strange to me but it's often hard to debug just by looking at screenshots.

 

Here's a variation that might be slightly more robust:

Before and After % of Row Total =
COUNT ( 'Before and After'[Progress Rating] )
    / CALCULATE (
        COUNT ( 'Before and After'[Progress Rating] ),
        ALL ( 'Before and After' ),
        VALUES ( 'Before and After'[Progress Category] )
    )

This removes all filters on that table then restores the category filter. Try ALLSELECTED instead of ALL if you want to want to preserve filters from outside the visual other than category.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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