Forum Discussion

nbarta's avatar
nbarta
Frequent Visitor
1 year ago

Calculating Weeks With Hours Worked

Hello - I need to calculate the number of weeks Employees have worked either regular or overtime hours. I have two tables - The first I'll call EmployeeData with distinct employee IDs and other relative data, and another I'll call EmployeeHours which is a table that records the daily number of hours containing Employee IDs, Full Date, Week Of Year, Regular Hours, Overtimehours. I need to put the total number of weeks worked into the table with distinct employee IDs. I cannot just count distinct WeekOfYear because sometimes the values of hours worked is 0. 

 

I'm trying to do a calculated column in the EmployeeData table but it's not working: 

EmpWeeksWorkedCalc =
CALCULATE(
    DISTINCTCOUNT('EmployeeHours'[WeekOfYear]),
      SUM('EmployeeHours'[OTHours]) > 0) || 
      SUM('EmployeeHours'[RegularHours>0)) 
 
 
Thanks for any help! 

2 Replies