We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula for Previous Day to exclude Weekends

verde0903
8 - Asteroid

Hello,

 

I run a report where I need it to bring costs updated on prior day.  On Mondays the prior day would be Sunday but in reality I need to bring Friday which was the last work week that costs were updated in the system.

 

I created a formula for [Last Update Date] = ToDate(DateTimeAdd(DateTimeToday(), -1, "days")) but how do I add a formula that if today is Monday it needs to bring back Friday's date.  Then from Tuesday thru Friday to bring today -1.

 

Thanks,

Maylen

5 REPLIES 5
Luke_C
17 - Castor
17 - Castor

Hi @verde0903 

 

Try this - it checks what day today is and does the formula appropriately.

 

More on datetime functions: DateTime Functions | Alteryx Help

 

IF datetimeformat(datetimetoday(),'%A')='Monday'
Then DateTimeAdd(DateTimeToday(), -3, "days")
Else DateTimeAdd(DateTimeToday(), -1, "days")
endif

 

binuacs
21 - Polaris
verde0903
8 - Asteroid

Thanks Luke for the quick resonse.  I will try and will let you know how it goes.

verde0903
8 - Asteroid

Thanks binuacs.  I will try and let you know.  Thanks for the workflow.

verde0903
8 - Asteroid

Hi binuacs

 

Using the formula you sent you, when I compare the dates to the report how would I get a Yes to note those that were updated prior date.  See attached workflow.

 

Thanks,

Maylen

Labels
Top Solution Authors