I would like to ask for help regarding my current task.
I need to calculate the difference between start date and actual date of leaving for employees. The number of working days should exclude Saturdays and Sundays.
I have tried several ideas found online and all the measures are in the attached PBI file. Still, the outcome of all of them is incorrect. Can’t navigate the problem here.
WorkingDaysOnly =
VAR SlctStartDate = Max('Leavers-NEW'[Start Date])
VAR SlctEndDate = MAX('Leavers-NEW'[Actual date of leaving])
VAR DaysInPeriod = DATESBETWEEN(DIM_TIME_WORKED_HOURS[OP_DATE],SlctStartDate,SlctEndDate)
VAR Result = CALCULATE(COUNTROWS(DIM_TIME_WORKED_HOURS),DaysInPeriod,NOT DIM_TIME_WORKED_HOURS[OP_DAYOFWEEKNO] IN{7,1} )
RETURN Result