In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

2 month dynamic date filter

AttilaBalint
6 - Meteoroid

Hello,

 

I am trying to create a dynamic filter which would contain current month and the previous month.

So far I have a code for the current month.

 

ToDate([Last Hire Date]) <= ToDate(DateTimeTrim(DateTimeToday(),"lastofmonth")) AND ToDate([Last Hire Date]) >= ToDate(DateTimeTrim(DateTimeToday(),"firstofmonth"))

 

Do anybody know how can I alter this so it also pulls the date for the previous month as well?

Thanks,

2 REPLIES 2
binu_acs
21 - Polaris

@AttilaBalint Update your formula like below which will pull all the data in current month and previous month

 

 

 

[Last Hire Date] <= DateTimeLastOfMonth()
AND
[Last Hire Date] >= toDate(DateTimeTrim(DateTimeAdd(DateTimeToday(),-1,'month'),'firstofmonth'))

 

binuacs_0-1679309471949.png

 

 

ShankerV
17 - Castor

Hi @AttilaBalint 

 

Use the below.

ToDate([Last Hire Date]) <= ToDate(DateTimeTrim((Datetimeadd(DateTimeToday(),-1,"month")),"firstofmonth"))

 

A small change will help you.

ToDate([Last Hire Date]) <= ToDate(DateTimeTrim(DateTimeToday(),"firstofmonth"))

(Datetimeadd(DateTimeToday(),-1,"month"))

 

 

 

Labels
Top Solution Authors