Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register 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!!!
User | Count |
---|---|
84 | |
78 | |
69 | |
46 | |
42 |
User | Count |
---|---|
106 | |
50 | |
49 | |
40 | |
39 |