In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Pulling Data from Previous Business Day

derm
7 - Meteor

I am attempting to pull data from the previous business day. This means that if the workflow is ran on a Monday, then Friday's data will be pulled. I would also like for the workflow to take holidays into account as well. How can I do that? I currently have the below formula to pull from previous business day but it isnt working.

if DateTimeFormat(DateTimeAdd(DateTimeNow(),-1,'days'),'%a') == 'Sun' then DateTimeAdd(DateTimeNow(),-3,'days') else DateTimeAdd(DateTimeNow(),-1,'days') endif

(From another user in the community) 

I am not sure how to incorporate holidays.

 

Please let me know how I can do it.

 

Thanks,

derm

4 REPLIES 4
Hamder83
11 - Bolide

Maybe this can help?
https://community.alteryx.com/t5/Community-Gallery/Business-Days-count/ta-p/962755


Else generate a list of holidays and append your dataset, and apply a filter?

derm
7 - Meteor

Hmmm I don't think this is what I'm looking for. The data I'm pulling from only has business days in it. What I meant was a formula or filter that could be ran daily and that would only show data from the previous business day. So, if I ran the workflow on a Monday, Friday's data would be the only data I see. If ran on Tuesday, I'd get Monday's data. 

binu_acs
21 - Polaris

@derm one way of doing this

Screenshot 2023-07-10 190107.png

rohityaman
8 - Asteroid

@dermHere is one proposed solution:

 

Step1: Create a field DayofWeek (integer data type) = ToNumber(DateTimeFormat(DateTimeNow(),"%u"))

 

Step 2: Extract Prev Business Day value using this formula:

IF [DayofWeek]>=2 AND [DayofWeek]<=6
THEN DateTimeAdd(DateTimeNow(),-1,"day")
elseif [DayofWeek]=7
THEN DateTimeAdd(DateTimeNow(),-2,"day")
else DateTimeAdd(DateTimeNow(),-3,"day")
endif

PrevBusinessDay.png

 

Labels
Top Solution Authors