Forum Discussion
P_Crane31
3 years agoFrequent Visitor
DAX elapsed time calculation misbehaving?
Hello all! I have two seperate, but related questions on some strange results when I use DAX to calcualte elapsed business days from order palcement to order shipment. Both issues occur on both Des...
- 3 years ago
I think you can just use the NETWORKDAYS function, e.g.
business_days_elapsed = IF ( NOT ( ISBLANK ( elapsed_time[order_received_in_hw] ) ) && NOT ( ISBLANK ( elapsed_time[order_last_updated_at] ) ), NETWORKDAYS ( elapsed_time[order_received_in_hw], elapsed_time[order_last_updated_at] ) )You can also provide to the NETWORKDAYS function a list of dates to consider as holidays.
P_Crane31
3 years agoFrequent Visitor
Oops... I just found the DAX formatter...
business_days_elapsed =
ROUNDDOWN (
DATEDIFF (
elapsed_time[order_received_in_hw],
elapsed_time[order_last_updated_at],
DAY
) / 7,
0
) * 5
+ MOD (
5 + WEEKDAY ( elapsed_time[order_last_updated_at] )
- WEEKDAY ( elapsed_time[order_received_in_hw] ),
5
)