Forum Discussion
Include Employee start and end date in Utilization %
I am calcualting Employee project utilization from Time sheet data and calendars that identifyy a work day and non work day, however, i need to now adjust utilization for terminated employees as thay are no longer available. I have a start date and end date for each employee (Blank end date if Still Working). How would I go about determing utilization for each employee based on termination date?
- Anonymous7 years ago
Utilization = -- Each user must have a unique name. -- If this is not the case, you should -- use a field that uniquely identifies -- a user. Such a field should be marked -- in Power BI as a row identifier. var __visibleUsers = SUMMARIZE( Users, Users[Name], Users[StartDate], Users[TerminationDate] ) var __numberOfWorkingHoursADay = 7.5 var __utilization = AVERAGEX( __visibleUsers, var __userStartDate = Users[StartDate] var __userEndDate = if( Users[TerminationDate] = BLANK(), date(2099, 1, 1), Users[TerminationDate] ) var __totalPossibleWorkingDays = COUNTROWS ( FILTER ( 'Working Dates', 'Working Dates'[IsWorkday] = "Yes", KEEPFILTERS( 'Working Dates'[Date] >= __userStartDate ), KEEPFILTERS( 'Working Dates'[Date] <= __userEndDate ), ) ) var __totalPossibleWorkingHours = __totalPossibleWorkingDays * __numberOfWorkingHoursADay var __totalMandatoryWorkedHours = CALCULATE ( SUM ( 'ActivityUpdates'[Hours] ), 'Working Dates'[IsWorkday] = "Yes" ) var __totalOvertimeWorkedHours = CALCULATE ( SUM ( 'ActivityUpdates'[Hours] ), 'Working Dates'[IsWorkday] = "No" ) var __totalWorkedHours = __totalMandatoryWorkedHour + __totalOvertimeWorkedHours var __totalPossibleWorkingHours = __totalPossibleWorkingHours + __totalOvertimeWorkedHours return divide( __totalWorkedHours, __totalPossibleWorkingHours ) ) RETURN __utilization
Best
Darek
- Anonymous7 years ago
OK, but what do you expect to see in the third column for each row? Would you please put the figures in there? It would be good if you could share a sample file and tell me what the measure should return for the visual(s) you've got in there. It's really hard to see where the formula breaks if there's no expectation set.
I need to see the data model, mate. If you have any cross-filtering, it might screw up the calculations. I just wonder why 'Working Dates' has a column DateAsInteger. You should not compare an int to a date (which __userStartDate and __userEndDate are). This will not return an error because of an automatic conversion since Date is stored as float and an int can be turned into a float as well.
Thanks.
Best
Darek
20 Replies
- AnonymousNot applicable
From your post it's not really clear what you're asking for...
Best
Darek
- wkeicher
Helper III
i need to include additional criteria in my Utilization % Calculation that takes into account an employees tenure. In other words if they were active employees or not. A terminated employee should no longer effect utilization as of the termination date. If an employee was hired on 1/1/2019 and was terminated on 6/30/2019, and during that time he worked 8 hours a day, he would be 100% utilized for that period. However, he would only be 50% utilized for all of 2019, because he was terminated on 6/30 (This is incorrect). Neeed assistance in incorprating termination date into the dax calculation for utilization.
Hope you can undestand this.
- AnonymousNot applicable
OK, for one employee the calculation is understandable. But what algorithm would you give for the calculation of utilization of a set of employees? Say you have 2 emps and the period is 1 year. Employee 1 worked fully for the first half of the year only. The other worked full-time for 3/4 of the year. What would be the total utilization for the two workers together?
If I were to define it, it would be something like:
( 1/2 + 3/4 ) / 2 = 5 / 8
Would you agree? If this is so, then the algorithm would be: For each employee calculate the ratio of utilization (it must be between 0 and 1, inclusive) in the selected period and then average over the employees.
Well, what do you say?
Best
Darek