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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Sum data using hierarchy and Dynamics 365

Hi, I've connected Dynamics 365 into Power BI and need to sum at different levels of the hierarchy. 

 

In dynamics we use Parent - Child relationships. The child can have an actvity count figure as well as the parent.

I need to do is identify the parent - I beleive I have done this using the Lookupvalue formula.

But I need to be able to get 1 figure showing activity count which is a sum of the count on all children AND the parent. At the moment I can only see how to sum the count on the children or the parent. Not both.

 

The hierarchy is either 2 or 3 levels high. So will need to look at child - parent - parent and have a figure at the very top entity of all underlying entities.

 

Has anybody done this before or able to help out?

 

Thanks

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Assume you have tables below:

Capture6.JPGCapture7.JPG

Then you could create columns and measures below:

columns:
path = PATH('Account Table'[child id],'Account Table'[parent id])

level = "Level"&" "&PATHLENGTH([path])
Measure = CALCULATE(SUM('Fact Table'[value]),FILTER(ALLSELECTED('Account Table'),FIND(MAX('Account Table'[child id]),[path],1,0)>=1))

Capture8.JPGCapture9.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Assume you have tables below:

Capture6.JPGCapture7.JPG

Then you could create columns and measures below:

columns:
path = PATH('Account Table'[child id],'Account Table'[parent id])

level = "Level"&" "&PATHLENGTH([path])
Measure = CALCULATE(SUM('Fact Table'[value]),FILTER(ALLSELECTED('Account Table'),FIND(MAX('Account Table'[child id]),[path],1,0)>=1))

Capture8.JPGCapture9.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Initially, i think we can use a matrix with many levels in rows to display the visual as expected.

However, without any more information, it is hard to give a clear solution.

Please let me know :

are the "child" and "parent" in the same table?

If they are not in the same table, please show me the relationships among the different tables.

 

Best Regards

Maggie

Anonymous
Not applicable

@v-juanli-msft  yes the child and parent are both the same Account entity.

 

A child account has a parent account. I've linked the child to the parent using the lookupvalue so I have an extra column in the Account table to show the hierarchy.

 

I could however duplicate the account table and link the two using Client ID and parentaccount ID as the relationship?

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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