Forum Discussion
Richard_Halsall
Helper IV
4 years agoCalculated column for overtime by specific task type
Hi, I need help in calculating an employees cumulative overtime hours by week for specific tasks The data is as shown I have 'half' created the OT calculated column with this DAX ...
- 4 years ago
Hi, Richard_Halsall
Please check the following methods.
OT = VAR currentEmpID = Time[EmployeeID] VAR currentLDW = Time[WeekNo] VAR currentContractHours = 40 VAR OT = CALCULATE ( SUM ( 'Time'[Duration] ),ALL ( 'Time' ), Time[EmployeeID] = currentEmpID && Time[WeekNo] = currentLDW&&'Time'[Task Type]="Working" )+CALCULATE ( SUM ( 'Time'[Duration] ),ALL ( 'Time' ), Time[EmployeeID] = currentEmpID && Time[WeekNo] = currentLDW&&'Time'[Task Type]="Onsite SB" ) - currentContractHours RETURN IF ( OT > 0, OT )Measure:
OT weekend = IF(SELECTEDVALUE('Time'[Start Date Site])=SELECTEDVALUE(Dates[WeekEnding]),SELECTEDVALUE('Time'[OT]),BLANK())Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-zhangti
Community Support
4 years agoHi, Richard_Halsall
Please check the following methods.
OT =
VAR currentEmpID = Time[EmployeeID]
VAR currentLDW = Time[WeekNo]
VAR currentContractHours = 40
VAR OT =
CALCULATE (
SUM ( 'Time'[Duration] ),ALL ( 'Time' ),
Time[EmployeeID] = currentEmpID
&& Time[WeekNo] = currentLDW&&'Time'[Task Type]="Working"
)+CALCULATE (
SUM ( 'Time'[Duration] ),ALL ( 'Time' ),
Time[EmployeeID] = currentEmpID
&& Time[WeekNo] = currentLDW&&'Time'[Task Type]="Onsite SB"
)
- currentContractHours
RETURN
IF ( OT > 0, OT )
Measure:
OT weekend =
IF(SELECTEDVALUE('Time'[Start Date Site])=SELECTEDVALUE(Dates[WeekEnding]),SELECTEDVALUE('Time'[OT]),BLANK())
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Richard_Halsall4 years ago
Helper IV
Many thanks just what I was after