March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi everyone!
I am having a hard time calculating average of children count in hierarchy.
For example:
Parent Product A has 2 children: B and C.
B has 3 items and C has 5 items assigned (count). Total count is 8, but how to get the average count for A? which is 4.
Many thanks!
Solved! Go to Solution.
@Gazi,
Please check if the following measure returns your expected result. If not, please share sample data of your table.
average = CALCULATE(COUNTA(Table[Item]),ALLEXCEPT(Table,Table[Product],Table[Item]))/CALCULATE(DISTINCTCOUNT(Table[Children]),ALLEXCEPT(Table,Table[Product]))
Regards,
Lydia
Hi Lydia!
Awesome!! It seems to be working! Sorry I forgot to mention - my hierarchy has 9 levels, not just 2 like in this example. So do you think I could extend your measure with a parameter or?
Many thanks!!!
@Gazi,
Please check if the following measure returns your expected result. If not, please share sample data of your table.
average = CALCULATE(COUNTA(Table[Item]),ALLEXCEPT(Table,Table[Product],Table[Item]))/CALCULATE(DISTINCTCOUNT(Table[Children]),ALLEXCEPT(Table,Table[Product]))
Regards,
Lydia
Hi Lydia!
Awesome!! It seems to be working! Sorry I forgot to mention - my hierarchy has 9 levels, not just 2 like in this example. So do you think I could extend your measure with a parameter or?
Many thanks!!!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
122 | |
89 | |
76 | |
58 | |
53 |
User | Count |
---|---|
196 | |
123 | |
107 | |
68 | |
65 |