Forum Discussion
hsparg008
4 years agoFrequent Visitor
Finding Working Hours Between Two Dates
I'm trying to find the number of working hours between two dates. I have a start and end date. Right now, I'm finding the number of working days between the dates and then multiplying it by the hours...
- 4 years ago
Hi hsparg008 ,
A new DAX used to return the number of workdays between date range. It always returns whole number.
NETWORKDAYS(<start_date>, <end_date>[, <weekend>, <holidays>])
NETWORKDAYS function (DAX) - DAX | Microsoft Docs
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
daXtreme
Solution Sage
4 years ago
If you turn a date/time into a number (say, you multiply it by 1.0), it'll give you a number. On such numbers you can carry out arithmetic to obtain durations in (fractional) days. Check this out:
EVALUATE
var dt = convert("2020-12-10 14:20:12", DATETIME)
return
{(1.0 * dt, dt)}
Run this in DAX Studio as is.