Forum Discussion
Problem calculation total work hours
I can't get to the answer for this with the information provided, can you supply some of your raw data or a sample of mocked up data? It sort of sounds like you are doing a join in M and perhaps you need to import them as separate tables and relate them properly in order to get the effect that you want.
Hi smoupre
Here's a mock up enclosed.https://www.dropbox.com/s/a1vn650ta4j0u3y/Eksempel%20til%20BI%20Community.pbix?dl=0
I have changed the fieldnames etc to english :-)
As you se I only get the value of total hours per week (97). Not the total value for all employees (196).
And another problem is, that it doesnt show the values per employee group but the same value for all groups.
- HenrikH299 years ago
Advocate I
No, when it's set both ways i get the same values like you (correct values) but the total is wrong.
The total is 97 but has to be 196 ?
- ceebu9 years ago
Advocate I
I believe the reason is because there does not exist any relationship between the Count of employees and the number of hours they have worked.
(In your excel file, you are multiplying total number of employees per calendar into the total hours per calendar to get the total value).
To replicate the same behaviour I have added a new column "Emloyee Total Hours" with the following formula:
Employee Total hours = CALCULATE(SUM(WorktimeCalender[Hours]),WorkTimeCalendarName[Calender no] = EARLIER(Employee[Calenderno]))
Then, when I use to total with this column, here is what I see:
Hope this achieves what you want :-)
- HenrikH299 years ago
Advocate I
Hi ceebu
I'm almost there, but when i adopt the solution to my original BI project i get a much to large sum off Employees Total Hours.
I belive it's because the calculation is done to each employee in the Employee table. However we have a lot of Employees in the table that aren't "active". I probably need to filter thoose out in the function.
The tables are connected to a table holding entries of how many hours each employee have worked (HoursWorked). I probably need to filter the function so it only calculates Employees Total Hours if the employee has entries in the table with the hours worked. The field with the hours worked are called "WorkHours"
Does that sound right - and how to?