Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I need to calculate the total work time per employee for a given period (ie month).
Our employees have a normal work time calender with a daily work time ie 7.5 hours monday to thursday and 7 hours friday totalling 37 hours per week. Some employees work parttime and have a differenct worktime calender ie. 6 hours a day totalling 30 hours per week. And some again have diffent worktimes per day/week.
A date table holds the daily work time per given worktime-calender:
Dato = Date
Timer = The total work hours that date
Kalendernr = The number for the special work-calender (ie Kalendernr "0" that has 7.5 hours per day exept friday thats 7 hours., Kalendernr "85" has 5 hours per day - not shown above, Kalendernr xx has other work hours etc.),
The Calendertable is joined with the employee-table:
Medarb nr. = the employee number
Kalendernr the joined field with the Calender-table
I have af period-slicer joined with the date table controlling the date interval and it works.
The problem is that the calculated value i get in the field "Timer" in the date table is only for one person - because the date table (workcalender) only hold the data once. I somehow have to multiply that with the number of employees with that given Work-calender - or ?.
Any ideas...
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.
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 🙂
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?
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.
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.
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.
You can easily add the Active status of the employee to the filter (visual filter or page filter or report filter) to achieve the desired result.
I added a new table with the Status Fields, and created a few employee records with Inactive status.
Then, I added the Status as a filter in the visual:
See the result with / without the filter.
Download the Updated PBX file here -
I'm having some troubles with calculating total time for a column. My data has Name, Date, Start time, Finish Time, Lunch break, Total hours work, Total hours (hh"mm), comment. My data came from spreadsheets with stuff worked on them and all I had to do was change time to duration or time and filter out the spreadsheets that I didn't want from a folder and other information. I have a slicer with these filters, Name and Date = relative date is in the last 1 calendar weeks. I have a total hours work Total but I wanted to try a Total hours(hh:mm) Total for the same filter date=relative date is in the las 1 calendar weeks. Is this possible? I just want a simple calculation to add the Total hours (hh:mm) column. So that total should read 20.30 next to the 20.50 total.
Thanks!
Hi ceebu
When i I download the updated file i get my "old" one. No ekstra table etc.
Perhaps you have oploaded the wrong one ?
However filtering using an "Active" field will not do the trick since employees going from Active to Inactive during the year has to be included.
I need to filter/calculate only on the emplyees who have entries in the Hoursworked table. That way they are included whether being Active or not (shiftet status) during the year.
@HenrikH29 wrote:Hi smoupre
And another problem is, that it doesnt show the values per employee group but the same value for all groups.
Did you make the cross filter direction "Both" under relationships ? This is what I get what I make that change..
User | Count |
---|---|
102 | |
91 | |
87 | |
79 | |
71 |
User | Count |
---|---|
113 | |
105 | |
101 | |
75 | |
64 |