Hi there,
Objective:
I have past 2-3 year data in my input everytime. I want alteryx to filter past 12 months data only (past 12 months from today's date) whenever I run my workflow. I want to make sure that alteryx automatically determine today's date and calculate what past 12 months date would be and filter the data accordingly. Is there any way I can do that?
Thanks in advance!
Hello @tushar44 ,
You can use for that the DateTimeNow() function. What you could establish on the filter would be something like this:
[DateField] >= ToDate(DateTimeAdd(DateTimeNow(),-1,'year'))
This will calculate first todays date, after that it will subtract a whole year and filter only the dates that are in that span.
Regards
@afv2688 ,
[DateField] >= ToDate(DateTimeAdd(DateTimeNow(),-1,'year'))
Alex, I highly recommend DateTimeStart() instead of DateTimeNow().
all comparisons are the same. This function uses 1 date for all comparisons. If I'm the event the job runs over midnight you will get the same result.
the fixed date -1 year will get different results if re-run on a different day. You might consider adding a detour to the workflow to allow the use of a fixed date in case issues exist.
cheers,
mark