Forum Discussion
Problem calculation total work hours
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.
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 agoAdvocate 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 agoAdvocate 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?
- ceebu9 years agoAdvocate I
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?
I didnt see this table in the sample you had uploaded, so replicated the function using a calculated column. (Also no HoursWorked in the three tables in your .pbix file) If you already had a list of days the employees haad worked, then you could use that to filter the total number of hours worked by the employee for the month.