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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mstanger
Frequent Visitor

PercOnParent (percent of total) and row label sorting

Messrs Ferrari and Russo (The Definitive Guide to DAX, p. 348) published a brilliant measure [PercOnParent] for calculating percentages on hierarchies.  My problem has been that it doesn't work if I sort my row labels on another column.  For anyone familiar with their measure, why does this happen and how can I fix it?

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

I'm not familiar with the measure you talk about, but I know how to write % of parent. I can tell you that if you sort your columns, you need to include both the column name and sort column in any ALL function.   So this

 

CALCULATE(SUM(table[value]),ALL([category]))

 

becomes this. 

CALCULATE(SUM(table[value]),ALL(prod[category],prod[category sort]))

 

i cover this towards the bottom of this article. https://exceleratorbi.com.au/the-all-function-in-dax/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

3 REPLIES 3
mstanger
Frequent Visitor

Also brilliant--thank you, Matt!

PS: I'm enjoying the new 3rd ed. of Supercharged!

I'm glad you like it.  I always appreciate a review at Amazon if you are willing. This is one of the best ways that other people can find my book (which is good for me, and them, I think 🙂 )



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
MattAllington
Community Champion
Community Champion

I'm not familiar with the measure you talk about, but I know how to write % of parent. I can tell you that if you sort your columns, you need to include both the column name and sort column in any ALL function.   So this

 

CALCULATE(SUM(table[value]),ALL([category]))

 

becomes this. 

CALCULATE(SUM(table[value]),ALL(prod[category],prod[category sort]))

 

i cover this towards the bottom of this article. https://exceleratorbi.com.au/the-all-function-in-dax/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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