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
angeloola
Helper I
Helper I

Column calculation that returns value in a hierarchy

I have a company ownership hierarchy table, where I need to add a column that indicates the ultimate parent. See example:

 

 

table.png

 

I need to calculate ultimate parent column based on the parent company ownership of company a. I have about 100k child companies with unique ids, each of which are associated with various parents with varying levels of ownership. 

The idea is to calculate a column that returns the ultimate parent based on the maximum percent ownership of each indiviual child company.

 

I've looked around the forum and tried a few things with no luck...

Thanks!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

For the example given, I would think that the formula would go something along the lines of:

 

 

Column = 
VAR __tmpTable = FILTER(ALL(Table),[child company] = EARLIER([child company])
VAR __max% = MAXX(__tmpTable,[% ownership by parent])
RETURN
MAXX(FILTER(__tmpTable,[% ownership by parent] = __max%),[parent company])

 

Something like that.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

For the example given, I would think that the formula would go something along the lines of:

 

 

Column = 
VAR __tmpTable = FILTER(ALL(Table),[child company] = EARLIER([child company])
VAR __max% = MAXX(__tmpTable,[% ownership by parent])
RETURN
MAXX(FILTER(__tmpTable,[% ownership by parent] = __max%),[parent company])

 

Something like that.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Awesome!! THANKS!! 🙂

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.