Forum Discussion
Problem calculation total work hours
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 ?
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.
- HenrikH299 years agoAdvocate I
Hi ceebu
No the table HoursWorked wasn't in the sample. I have several tables not included since it would be a huge task to make af sample of all the tables.:smileyhappy:
The table Hoursworked holds entries per employee per customer they have worked on. So theres many entries per day for the same employee.
You are suggesting to filter using the Hoursworked table, it just can't figure out how - using a join or a function ?
My problem is that it calculates all hours fore all employes in the Employee table. However i only wnat it to calculate on the emplyees who have entries in the Hoursworked table.