Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Replicating Excel WORKDAY Function in Alteryx - feel free to use it if useful

IPWE
5 - Atom

So I'm quite new in Alteryx and been moving reports from manual tools (access/Excel) to Alteryx. 

 

Just realized that there is no function in Alteryx to easily calculate x amount of working days from a starting date (e.g. 28th Oct 2016 + 2 days = 1st of October 2016) so decided to write my own one (unless there is one in that case I wasted an hour of my time for this).

 

Then I found out that I can’t do while loops (Like I said, new in Alteryx), so I managed to do one without a while loop, 

 

The basic of the formula is this:

 

Start Date + (Floor( ((Daysof Week+DaysToAdd)-1/5)*2) + DaysToAdd = end date

 

If the Start Date is Sat/Sun then start from previous Friday.

 

Feel free to use it if you guys think it is useful.

13 REPLIES 13
KeithH
6 - Meteoroid

Hello! Holidays are not mandatory. I believe the issue is you are not including a field which specifies the number of days you would like to add to the start date. So in your data source, one column should be the start date, and another column should be days to add. For example, I take ORDER DATES and add LEAD TIME in business days to arrive at an EXPECTED DELIVERY DATE. 

 

This input:

KeithH_1-1642530866086.png

 

With this configuration:

KeithH_2-1642530896966.png

 

Results in this output:

KeithH_0-1642530836627.png

 

KeithH
6 - Meteoroid

Mond, looking at it again, I think I may know the issue. My workflow can only count forward, if you are trying to count backward (i,e., entering a negative value for "days"), it will not work. I haven't tried to modify it to count backwards because that has not been necessary for me. 

Mond
8 - Asteroid

i was only really affected by the weekend so i just implemented a formula to check if the day is a monday or not and if so adjust the date to be the prior friday. it worked for my use case.

apoorba
5 - Atom

Hi..

Did anybody try to use this macro ? Except a few dates, it is working fine like Workday() of Excel . Any new version or fix for this macro ? Appreciate any help.

I am referring to this macro from Paul_C.

Labels