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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Calculated Columns based on Hierarchy

Hello together,

 

I would like to perform the following calculation in PowerBI using calculated columns:

We have an organizational structure that can have any number of levels. For each organization no matter what level we have given the following columns:

Organization IDParent IDSales
1 20
2150
3120
4220
5450
6470

 

Now I would like to calculate for each organization the average of the "sales" of its subsidiary units. Including its own value. I would have solved this normally via a table for each level but the number of levels is constantly changing and I don't want the dashboard to have to be adjusted each time. See the following chart as an example of the levels in the table above.

Merlin_25_0-1644237855517.png

So instead of creating many tables I would like to put the calculation in the following table where all the organizations are included.

Organization IDParent IDSalesSales Average
1 20(20+50+20)/3
2150(50+50)/2
312020/1
4220(20+70+60)/3
5460

60/1

647070/1

 

So far I have only one column in which I calculate the sum of all directly linked units but without their daughter units and without dividing by the number for the average.

Merlin_25_1-1644239760709.png

 

How would you approach this, has anyone had a similar problem?


Thanks a lot for your answers!

1 ACCEPTED SOLUTION
Anonymous
Not applicable
3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

Have difficult about the logic.

Why the average of Organization ID 2 is (50+50)/2?

Where the second "50" from?

 

Best Regards,

Jay

Anonymous
Not applicable

Hi @Anonymous,

 

thanks for looking at my issue.

 

The Average formula is: (Own Sales Value + Sum (Average of child units)) / (Count of Child units + 1)

So in the case of Organization 2 its is (50 (Own Value) + 50 (Value Organization 4)) / 2

Anonymous
Not applicable

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.