Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Don't forget to submit your entry for the Excellence Awards by October 30! | Need more information about the program? Check out the blog here

How To: Calculate the difference between two dates excluding weekends including time

Highlighted
Alteryx Partner

I've put together an alteryx workflow to calculate the difference between two dats in datetime format that gives an output calculated to the minute, not just to the day. This question has come up several times and while there are  few responses on it here, thought i'd rethink it from scratch.

 

img_DateDiff.png

 

 

This workflow details the steps you need to remove weekends between two dates and is therefore, more accurate than the network days you get from excel. The output is in days but multiplying by 1440 will give you the duration in minutes.

 

The workflow first trims the datetime to dates, determines the duration in whole days and then takes the hours and minutes and applies math to either add or subtract the fractional hours in minutes (converted to days) and adds that to the duration calculated previously.

 

The workflow has some sample data to view the output. Let me know if you have any issues or questions. If this works well, I have some ideas of incorporating holidays as well..

Labels