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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
XH
New Member

How to use a percentage by legend for a column chart

Hi,

 

I'm trying to calculate the percentage for each color based on the total amount they have for a selected week. SUM(myTable[Color] gives me the correct amount of seconds for each category, and so now I was trying to find a way to calculate the total amount of seconds without considering the category, to obtain a percentage, but the percentage I obtain is far from 100%. How would I/should I proceed to obtain the percentage by color in that situation?

PercentagePerColor.png

1 REPLY 1
audreygerred
Super User
Super User

Hi! You would want to make a measure that ignore the context of category (and or whatever else you may want to show that data by so that you can obtain your denominator). I also suggest making an explicit measure for SUM(myTable[Color]) if you don't already have one.

Measure =
DIVIDE(
SUM('myTable'[Color],
CALCULATE(
SUM('myTable'[Color]),
ALL('myTable')
)
)

 

If you want the measure to only ignore some filters, but not all (for example, if you want the date filter to not be ignored), use ALLEXCEPT instead of ALL. ALLEXCEPT function (DAX) - DAX | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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