Hi,
I have a workflow that I run every Monday and it is for the prior week. For example if I run it on 2021-08-16 then the output needs to include data from 2021-08-09 to 2021-08-15(Mon-Sun). Is there a tool which will enable me to have the dates automatically updated each week to capture the prior week? Also, schedule the workflow to run every Monday?
Solved! Go to Solution.
You can create a formula that does this
Yesterday = DateTimeAdd(DateTimeToday(),-1,"day")
Last week = DateTimeAdd(DateTimeToday(),-7,"day")
Use that in a filter to compare against the date that you want.
To schedule, you need Alteryx Server or the Scheduler option for Designer.
@cmcclellan thank you for the response! Not able to follow this. Should I use both formulas?
@cmcclellanis explaining the two formula you need in your filter tool (assuming you have your date field in alteryx format dates)... it would be [date]>= datetimeadd(datetimetoday(),-7,"days") and [date]<=datetimeadd(datetimetoday(),-1,"days")
as far scheduling goes - do you have scheduler? it's fairly straight forward if you do.
@apathetichell Thanks for the explanation! Let me explain my current workflow process and the output I'm getting after I tried this formula along with a logic.
The dataset includes a field called created date where it includes all the data and date format is as seen below
Created date
2021-08-11 00:12:00
2021-07-01 11:57:00
2021-05-20 00:03:00
2021-08-01 04:00:00
I used a input text tool and added two columns as start date and end date and randomly set it from 2021-01-01 to 2021-01-08. Then used two formula tools with below formula
You could also just use the Basic filter options as below which I have set up to keep the dates for the last 7 days, excluding today. it's a zero based count hence Number of Periods = 6.
@jrgo - That is some mad knowledge on basic filters. Great job.
@jrgo @apathetichell Both solutions worked. Thank you so much for your help on this 🙂