Forum Discussion
Staff Worked Hours Vs Rostered Hours
Hi, I am relatively new to Power BI.
Trying to create a report that shows: -Employee Name -Hours Worked (Time Slot Summary table) -Expected Hours (rostered hours, based on 'Staff_Hours' table) The Report user will then specify a from/to date filter in the report to see range they expect. I have managed to get 'Hours Worked' from the 'Time Slot Summary' table to work as expected. Now need to figure out how to create 'Expected Hours'/ 'Rostered Hours' as a column or new table based on roster/daily hours in the 'Staff_Hours' table. The 'Staff_Hours' table works in the way that each day, Mon-Sunday has been coded with a value 0-6, Monday = 0, Tuesday = 1, Wednesday = 2, ... Sunday = 6 with the rostered hours against each EmployeeID.
Staff_Hours table example:
Overview:
Now I want to either add the 'Expected Hours'/ 'Rostered Hours' to the 'Time Slot Summary' table or create a new table containing EmployeeID, Date, DailyHours (Expected Hours).
Holiday table:
Employee table:
Time Slot Summary table:
'Expected Hours' also needs to take into account any potential Public Holidays there might be, example 15/10/2018 is a Public Holiday therefore automatically subtract/ deduct 7.5 hours from that days 'Expected Hours'.
Public Holidays are recorded in the "Holiday' table and need to be applied in accordance with the 'Location' of the employee
Expected Hours table expectation/ idea:
Example final report sketch:
From
09-01-2018
To:
09-30-2018
Employee Name Worked Hours Expected Hours Difference
John Smith 140 150 -10
Jane Smith 150 150 0
Any helps to how I might achieve this would be much appreciated.
Hi LivioLanzo, I managed to simplify the dataset and work out the most difficult part for me - how to translate the Staff_Hours[Daily Hours] into the Time Slot Summary[Rostered Hours] by using of the following DAX code.
Rostered Hours = LOOKUPVALUE(Staff_Hours[Daily Hours], Staff_Hours[EmployeeID], 'Time Slot Summary'[EmployeeID], Staff_Hours[WeekDayNumber], 'Time Slot Summary'[WeekDayNumber]).
The rest should be pretty straight forward. Thanks again for offering to help, next time maybe.
5 Replies
- LivioLanzoSolution Sage
- LandcrabHelper I
Thank you offering to help LivioLanzo, unfortunately I cannot share the pbix file. If you offer still stands to help and my description is not clear please ask and I can try explain the situation bettter.
Thanks again.
- LivioLanzoSolution Sage
Hi Landcrab
you have quite a few tables in your model and I would need to replicate them all manually in order to test something and at the end I could come up with a wrong measure / model because my replication was not correct
- AnonymousNot applicable
Landcrab can you please share the pbix file with trim down non-confidential data?