Alteryx Designer Desktop Discussions

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

Find previous Date

Inactive User
Not applicable

I currently have a table of all the business days of the year. WorkingDays [BusDate]. I have a file that contains the current date WorkingFile [CurrentDate]. I am trying to figure out how to find the previous business day from the [BusDate] field in the WorkingDays table using the [CurrentDate] in the WorkingFile table, and return it to a field labeled [PriorBusDate] in the WorkingFile. For some reason this is difficult for me.  

 

2 REPLIES 2
mceleavey
17 - Castor
17 - Castor

Hi @Inactive User ,

 

Can you provide a mock dataset so we can help?

 

Thanks,

 

M



Bulien

echuong1
Alteryx Alumni (Retired)

There are multiple ways of doing this, but I would use a conditional statement to figure out the day of the week and base my calculation off of that.

 

if DateTimeFormat(DateTimeAdd([Current Date],-1,'days'),'%a') = 'Sun' then DateTimeAdd([Current Date],-3,'days')
elseif DateTimeFormat(DateTimeAdd([Current Date],-1,'days'),'%a') = 'Sat' then DateTimeAdd([Current Date],-2,'days')
else
DateTimeAdd(DateTimeNow(),-1,'days') endif

 

echuong1_0-1610646402810.png

 

Labels