Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Dynamic Date Filtering

mystasz
8 - Asteroid

Hello, 

 

I have a dataset that ranges from April 2018 - April 2022. 

 

I need to split the data into two data sets. I got the first one, but can't seem to figure out how to do the second one. Any suggestions? 

1. Filter last 12 months (April 2021 - April 2022) 

2. Filter the 12 months, 3 years ago. (April 2018- April 2019) 

 

For the 1st one I did which filters the "Date" column for the last 12 months. 

datetimediff(datetimetrim(datetimetoday(),'month'),[Date],'month')
<= 12

AND

datetimediff(datetimetrim(datetimetoday(),'month'),[Date],'month')
>= 1

 

 

1 REPLY 1
IraWatt
17 - Castor
17 - Castor

Hey @mystasz,

I think this setup creates your 2nd dynamic filter (workflow attached): 

IraWatt_0-1651594732600.png

 

 

 

[RowCount] >= DateTimeAdd(DateTimeNow(),-4,"years") AND
[RowCount] <= DateTimeAdd(DateTimeNow(),-3,"years")

 

 

This will work assuming your using a date/datetime column type. Any questions on how this works make sure to ask :)

HTH,

Ira

Labels
Top Solution Authors