I’m working to write a measure to get the calculation of the theoretical effort spent on a ticket.
Each ticket has a creation and, when resolved, a resolution date.
I need to compute the theoretical effort spent on each ticket considering 8 hours per working days and 0 for Saturday and Sunday, considering the dates between the Create and End date.
This below is my attempt and even if very “naive” it’s working, but soon I’ll need to consider not only the day but also the hours when tickets are created and closed.
Is there any other smarter way to face this kind of pattern?
I’ve been looking for other similar topics, but I found none.
I don’t need an off the shelf solution, but some hint would be really appreciated.
Thanks a lot
Theoretical Effort (hrs) = VAR _Start = MIN ( Tickets[Created date] ) VAR _End = if(ISBLANK(MAX(Tickets[Resolved date])), TODAY(), MAX ( Tickets[Resolved date] )) VAR _NumOfDays = DATEDIFF ( _Start, _End, DAY ) VAR _Dates = DATESINPERIOD ( 'Calendar'[Date], _Start, _NumOfDays, DAY ) VAR _WorkingDayHours = 8 RETURN ( COUNTROWS ( FILTER ( _Dates, WEEKDAY ( 'Calendar'[Date], 2 ) <= 5 ) ) + 1 ) * _WorkingDayHours