Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Dynamic Date Range: Rolling 12 Months - Prev Month

pennyra
5 - Atom

I'm trying to build a dynamic date range to filter on a rolling 12 months - end of the previous month.

 

For example: Today is 9/21/2020, so I want my date filter to show 9/1/2019 - 8/31/2020. 

 

Thanks for your help. 

 

 

4 REPLIES 4
wdavis
Alteryx
Alteryx

Hi @pennyra 

 

The attached workflow should allow you to do this. You would need to update this with your own Field for the current date.

 

You can then use a combination of the DateTimeAdd and DateTimeFirstOfMonth to create the 2 new dates to filter the data on.

 

Let me know if this works for you.

 

Kind Regards,

Will

ConnorK
Alteryx
Alteryx

Hi @pennyra,

 

To dynamically filter for these dates you may try using the "DateTimeFirstOfMonth()" and the "DateTimeAdd()" formula to find the first day of the current month and then subtract a year from that date. I have attached an example of this building out two field (Start_Date & End_Date) which can then be used to filter on in a Filter tool.

 

I hope this helps!

Connor Kelleher
Senior Sales Engineer
Alteryx
echuong1
Alteryx Alumni (Retired)

You can built your filter ranges using datetime formulas. From there, append the range value to each record and create a filter.

 

echuong1_0-1600696201166.png

 

HomesickSurfer
12 - Quasar

Hi @pennyra 

 

1) Create [FIRST DATE] formula (Date type:Date):

DateTimeAdd(DateTimeAdd(DateTimeToday(),-12,"months"),1-DateTimeDay(DateTimeAdd(DateTimeToday(),-12,"months")),"days")

 

2) Create [LAST DATE] formula (Date type:Date):

DateTimeAdd(DateTimeToday(),0-DateTimeDay(DateTimeToday()),"days")

 

3) Apply Custom filter to records:

[DATE]>=[FIRST DATE] AND
[DATE]<=[LAST DATE]

Labels