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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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