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.

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