Forum Discussion
Percentage calculation for hierarchical data
Hi All,
I am stuck with my power bi report & wondered if someone knows how to do this? I am trying to calculate turnover % - the hierarchical data is by department, team and location - I can create a matrix table with department, team, and location and able to have correct sum data for leavers and count of staff, but cannot workout how to calculate the % for each level - It adds all percentages from lower hierarchies.... has anyone come across this at all? Thanks in advance 🙂
| Row Labels | Sum of Leavers | Sum of Staff Numbers | % As should be | In Power BI |
| Dept 1 | 11 | 59 | 19% | 91% |
| Team A | 7 | 31 | 23% | 63% |
| Location 1 | 2 | 10 | 20% | 20% |
| Location 2 | 4 | 15 | 27% | 27% |
| Location 3 | 1 | 6 | 17% | 17% |
| Team B | 4 | 28 | 14% | 28% |
| Location 1 | 1 | 8 | 13% | 13% |
| Location 2 | 3 | 20 | 15% | 15% |
- Anonymous5 years ago
Hi MitaSaxena ,
According to your description, I create this data:
Here are the steps you can follow:
1. Create measure.
% As should be = DIVIDE(SUM('Table'[Leavers]),SUM('Table'[Staff Number]))2. Result
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- lbendlin
Super User
At the very minimum you need to add a column to your data that indicates the hierarchy level for each row. Then you can filter by that level as needed.
- AnonymousNot applicable
Hi MitaSaxena ,
According to your description, I create this data:
Here are the steps you can follow:
1. Create measure.
% As should be = DIVIDE(SUM('Table'[Leavers]),SUM('Table'[Staff Number]))2. Result
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- MitaSaxenaFrequent Visitor
Thank you so much, it would make such a big difference. I am surprised that exactly same formula does not work as a column, but does as a measure. Will need to learn more about this. Thanks again.