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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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