Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Choose current month, plus last two months

irvinsotelo
5 - Atom

Hi Alteryx Community, 

 

I'm new to Alteryx and have started to use the program to automate a couple of function. I'm looking to create the following rule, but I'm stuck. Hopefully, you're able to help!

 

I need to come up with a rule to look at the current month (October 2021) and the last two months (August & September 2021) and only look at those records. 

 

Start Date
2021-10-01
2021-10-01
2021-10-01
2021-09-01
2021-09-01
2021-08-01
2021-08-01
2021-01-01
2021-02-01

 

This would have to be automatically picked on a monthly basis. In other words, in November of 2021, it would have to look at November, October & September 2021 records. 

 

Thank you!

4 REPLIES 4
AZuc
Alteryx Alumni (Retired)

@irvinsotelo see if it helps

André Zuccatti

Sales Engineer - LATAM -
Alteryx, Inc.


csmith11
11 - Bolide

Datetimeformat([Start Date],"%m-%Y") in
(
Datetimeformat(DateTimeToday(),"%m-%Y"),
Datetimeformat(Datetimeadd(DateTimeToday(),-1,"Month"),"%m-%Y"),
Datetimeformat(Datetimeadd(DateTimeToday(),-2,"Month"),"%m-%Y")
)

csmith11
11 - Bolide

The attached example uses the formula from below:

 

Datetimeformat([Start Date],"%m-%Y") in
(
Datetimeformat(DateTimeToday(),"%m-%Y"),
Datetimeformat(Datetimeadd(DateTimeToday(),-1,"Month"),"%m-%Y"),
Datetimeformat(Datetimeadd(DateTimeToday(),-2,"Month"),"%m-%Y")
)

 

The formula checks for each record whether the Start Date's Month and Year are found in the dynamic list:

Today's Month-Year,

Last Month's Month-Year,

2 Months Prior Month-Year.

 

Please let me know if you have any questions.

 

 

irvinsotelo
5 - Atom

This worked!!!! Thank you very much @csmith11 

Labels