cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MitaSaxena
Frequent Visitor

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%

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @MitaSaxena  ,

According to your description, I create this data:

v-yangliu-msft_0-1611285981605.png

Here are the steps you can follow:

1. Create measure.

% As should be =
DIVIDE(SUM('Table'[Leavers]),SUM('Table'[Staff Number]))

2. Result

v-yangliu-msft_1-1611285981613.png

 

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.

View solution in original post

3 REPLIES 3
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.

v-yangliu-msft
Community Support
Community Support

Hi  @MitaSaxena  ,

According to your description, I create this data:

v-yangliu-msft_0-1611285981605.png

Here are the steps you can follow:

1. Create measure.

% As should be =
DIVIDE(SUM('Table'[Leavers]),SUM('Table'[Staff Number]))

2. Result

v-yangliu-msft_1-1611285981613.png

 

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.

View solution in original post

lbendlin
Super User III
Super User III

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.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.