cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
khizerdaar
Frequent Visitor

% of Parent Row Total for Multi-level Hierarchy

Hi,

 

I'd like to preface by saying I have tried looking for a solution to my case on the forum - I found two potential solutions, implemented both, neither worked completely for my case. The problem is the lack of a "show values as % of Parent Row Total for a multi-level hierarchy". 

 

Details for the below attached case:

 

Source Table Name: 'All Customer Files'

Source Table Values: 'All Customer Files' [Value]

Four hierarchies from the table in this order: [Category Name], [Subcategory Name], [Form], [Brand Name]

Four custom measures: Current Month, Last Month, P6M and vs P6M

 

Has anyone had success in a case like this and if so what code did they use?

 

 

% of Parent Row Total.png

1 ACCEPTED SOLUTION

Accepted Solutions
JustJan Resolver IV
Resolver IV

Re: % of Parent Row Total for Multi-level Hierarchy

Hi @khizerdaar 

 

Maybe this can help you: 

 

2020-01-26 11_29_24-Window.png

 

there are a number of measures here. (In the visual they are  just there to check the result)

The measures are: 

 

% State =
divide([Sales Amount], CALCULATE([Sales Amount], ALL('Customer'[State])))
% Country =
divide([Sales Amount], CALCULATE([Sales Amount], ALL('Customer'[CountryRegion], Customer[State])))
% Continent =
divide([Sales Amount], CALCULATE([Sales Amount], ALL('Customer')))
Row Level = 
Switch (
   true(),
   ISFILTERED(Customer[State]), "State",
   ISFILTERED(Customer[CountryRegion]), "Country",
   ISFILTERED(Customer[Continent]), "Continent",
   NOT ISFILTERED(Customer[Continent]), "Overall"
)
% ParentRow = 
Switch (
   true(),
   ISFILTERED(Customer[State]), [% State],
   ISFILTERED(Customer[CountryRegion]), [% Country],
   ISFILTERED(Customer[Continent]), [% Continent],
   NOT ISFILTERED(Customer[Continent]), [% Continent]
   )

 

It should not be too much of a problem to translate it to your own model.

 

Hope this helps (completely 🙂 )

 

Jan 

 

View solution in original post

1 REPLY 1
JustJan Resolver IV
Resolver IV

Re: % of Parent Row Total for Multi-level Hierarchy

Hi @khizerdaar 

 

Maybe this can help you: 

 

2020-01-26 11_29_24-Window.png

 

there are a number of measures here. (In the visual they are  just there to check the result)

The measures are: 

 

% State =
divide([Sales Amount], CALCULATE([Sales Amount], ALL('Customer'[State])))
% Country =
divide([Sales Amount], CALCULATE([Sales Amount], ALL('Customer'[CountryRegion], Customer[State])))
% Continent =
divide([Sales Amount], CALCULATE([Sales Amount], ALL('Customer')))
Row Level = 
Switch (
   true(),
   ISFILTERED(Customer[State]), "State",
   ISFILTERED(Customer[CountryRegion]), "Country",
   ISFILTERED(Customer[Continent]), "Continent",
   NOT ISFILTERED(Customer[Continent]), "Overall"
)
% ParentRow = 
Switch (
   true(),
   ISFILTERED(Customer[State]), [% State],
   ISFILTERED(Customer[CountryRegion]), [% Country],
   ISFILTERED(Customer[Continent]), [% Continent],
   NOT ISFILTERED(Customer[Continent]), [% Continent]
   )

 

It should not be too much of a problem to translate it to your own model.

 

Hope this helps (completely 🙂 )

 

Jan 

 

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors