Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Selecting last date of the prior month

ilovecoding
8 - Asteroid

Lets say every month i have 2 months in dataset. Today is 2nd May, how can i filter last day of previous month from column Date. Note, this data changes every month, so example in Jun, i'll have column for May as prior month and Jun as current month and i have to select last day of May.

 

 

Date

04/02/24

04/08/24

04/20/24

04/30/24

05/01/24

05/02/24

 

3 REPLIES 3
ChrisTX
15 - Aurora

Try this in a Formula tool:  ToDate(DateTimeTrim(DateTimeAdd(DateTimeNow(),-1,"months"),"lastofmonth"))

 

Screenshot 2024-05-22 101326.png

 

Chris

cjaneczko
13 - Pulsar

You can use the following

 

datetimeadd(datetimetrim(DateTimeParse([Date],'%m/%d/%y'),'firstofmonth'),-1,'day')
Raj
15 - Aurora

@ilovecoding 
another formula for doing this

datetimeadd(datetimetrim(DateTimeParse([Field1],'%m/%d/%y'), 'month'), -1, 'day')

hope this helps.

Labels