Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

,How to skip counting weekends between two dates

Sanjana_HS
8 - Asteroid

Hi,

I need to count 5 days from Date1 which shouldnt be including saturday and sunday. For example

My Date1 is : 25th Jan 2024 (thursday)
Output I need : 1st Feb 2024 (thursday) skipping 27 and 28th of Jan because those two fall on weekend.

How to incorporate this in formula tool?

I have used this formula:
IIF(DateTimeformat(DateTimeAdd([Questionnaire Received],5,'days'),'%A') == 'Sunday',DateTimeAdd([Questionnaire Received],6,'days'),IIF(DateTimeformat(DateTimeAdd([Questionnaire Received],5,'days'),'%A') == 'Saturday',DateTimeAdd([Questionnaire Received],7,'days'),DateTimeAdd([Questionnaire Received],5,'days')))

This is working fine only when my due date falls on saturday and sunday it will add extra days but what i need alteryx to do is to skip counting weekends itself!

Appreciate any help. Thank you in advance

9 REPLIES 9
aatalai
14 - Magnetar

use the TS filler tooler, and set it to only weekdays, and then count record tool to see how many are inbetween the days

Sanjana_HS
8 - Asteroid

I dont have that tool. Can you suggest something else

aatalai
14 - Magnetar
aatalai
14 - Magnetar

otherwise let me know and I can suggest a way using generate rows, but it will be significantly more complicated

aatalai
14 - Magnetar

@Sanjana_HS how are you getting on?

danilang
19 - Altair
19 - Altair

Hi @Sanjana_HS 

 

Try this 

If DateTimeDay([StartDate]) = 6 then
	DatetimeAdd([StartDate],9,"days")
elseif DateTimeDay([StartDate]) = 7 then
	DatetimeAdd([StartDate],8,"days")
else
	DatetimeAdd([StartDate],7,"days")
endif

 

If your start date is Saturday add 9 days, if Sunday add 8 days, else add 7.

 

Dan

 

binuacs
20 - Arcturus
Sanjana_HS
8 - Asteroid

It helped. But what if i want to add 10 days for the same date. Will it work the same? Because what i understood was it will work only for 7 days for a week

For Example:

From the above formula i got date as 26th Jan 2024. Now from this again i need to add 10 days with same logic skipping weekends.

Akash08
5 - Atom

Hi, 

1) First find the initial day of the week on initial date.

2) Then do T+5 and find its T+5 day as well

3) Check if T+5 day is Sun, Sat, Mon, Tue then add 2 more days

 

find the workflow attached. Hit as a solution if this helps. Thank you.

Labels