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. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Last Calendar Day of Prior Month Formula Not Working - Please help

RCern
8 - Asteroid

The formula below is returning "2024 10 30" but I am trying to have the formula return the last "calendar" day of the prior month based on today's date which I am expecting to be "2024 10 31".   Can anyone tell me what I am doing wrong?

 

Datetimeformat(Datetimeadd(DatetimeTrim(Datetimenow(),"Lastofmonth"),-1,"Months"),"%Y %m %d")

3 REPLIES 3
alexnajm
19 - Altair
19 - Altair

You'll have to go to the previous month first and THEN convert to the last of the month (since different months have different ending days)

 

Datetimeformat(Datetimeadd(DatetimeTrim(Datetimenow(),"Lastofmonth"),-1,"Months"),"%Y %m %d") --> Datetimeformat(DatetimeTrim(DateTimeAdd(Datetimenow(),-1,"Months"),"Lastofmonth"),"%Y %m %d")

RCern
8 - Asteroid

Ahhh so simple.  Thank you!!!!

alexnajm
19 - Altair
19 - Altair

Happy to help!

Labels
Top Solution Authors