Forum Discussion

MitaSaxena's avatar
MitaSaxena
Frequent Visitor
5 years ago
Solved

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 LabelsSum of LeaversSum of Staff Numbers% As should beIn Power BI
Dept 1115919%91%
Team A73123%63%
Location 121020%20%
Location 241527%27%
Location 31617%17%
Team B42814%28%
Location 11813%13%
Location 232015%15%

 

  • Anonymous's avatar
    Anonymous
    5 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

  • 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.

  • Anonymous's avatar
    Anonymous
    Not 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.

  • MitaSaxena's avatar
    MitaSaxena
    Frequent 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.