Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BobKoenen
Helper IV
Helper IV

Matrix with hierachy does not show correct Totals on higher agregation Dealing with Hourrates

Hi all,

 

I am creating an overview based on hourly rate and nr. of hours for employees in an Matrix using a hierarchy. In which the Department is the highest level en employee the lowest. However I cannot figure out how to deal with the HourRates. 

The data looks like this:

DepartmentPersonHourrateHoursTotal
AJohn1020200
BJane1030300
BJoe1520300
BJames50150
Total 8571850

 

When I fold the Matrix the calculations become incorrect at the department level. 

 

A 10233200
 75513825
total 852844025

 

This is because the Hourrate colomn is summed. I tried to switch off the summing in the values plane of the visual but that does not work for me because I need the totals on departmentlevel.  Using Average also is not correct because of the differences in amount of hours. 

I think i Need a formula which adds all the values on the employee level en shows that as in the total row. Not calculating the amount from the total row itself. 

 

I hope you can help me. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The hour rate on the department level, or any level for that matter, needs to be a weighted average of the hour rates for each employee. The weights are the hours.

 

Why so? Because [Hourrate] * [Hours] = [Total] and this equation must be maintained on each row, even the last one.

 

So, the answer is easy: the hour rate must be the sum of rate * hours over all visible employees and divided by the sum of the hours for the same set of employees.

 

Best
D

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

The hour rate on the department level, or any level for that matter, needs to be a weighted average of the hour rates for each employee. The weights are the hours.

 

Why so? Because [Hourrate] * [Hours] = [Total] and this equation must be maintained on each row, even the last one.

 

So, the answer is easy: the hour rate must be the sum of rate * hours over all visible employees and divided by the sum of the hours for the same set of employees.

 

Best
D

Greg_Deckler
Super User
Super User

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

Also, you may need this:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thankx this is very Helpfull

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors