ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Count workday difference between 2 dates

7 - Meteor

Hi All,


Recently I am working on report automation related to the maturity date difference calculation. We just count workdays in the calculation.

In the forum, I could find many great workflows how to calculate the workdays. Nevertheless, it seems most of them require the steps to define Sat and Sun before we can filter out the weekdays for further calculation.

With loads of entries, Alteryx requires defining Sat and Sun repeatedly in date difference of each entry and it slowed down the performance.

Any ways we can skip the Sat and Sun definition step or just define one time only and applied to all other entries?



16 - Nebula
16 - Nebula

Assuming you are only dealing with Saturdays and Sundays you can do this using a formula.


If you can use a third party library then I have BUSINESSDAYS function within my Alteryx Abacus function library. This reproduces the Excel  NETWORKDAYS function.


 Alternatively you can use :

1 + ((DateTimeDiff(End,Start,"days")*5 - (ToNumber(DateTimeFormat(Start, "%w"))-ToNumber(DateTimeFormat(End, "%w")))*2) / 7) + 
IIF(DateTimeFormat(End, "%w")=="6",-1,0) + IIF(DateTimeFormat(Start, "%w")=="0",-1,0)

Sample attached


7 - Meteor

Very useful! Really help speed up the whole process, thanks!!!

5 - Atom

Awesome, how cool is that formula!


Does make me wonder though (as a pure newbie to Alteryx), why it's not in the base toolset (or is it now?), given how popular it's use is in Excel.

7 - Meteor


7 - Meteor

You are right. Aniticipating Alteryx team to build the workday formula function for us.