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
binuacs
20 - Arcturus

@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