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
18 - Pollux
18 - Pollux

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
18 - Pollux
18 - Pollux

Happy to help!

Labels
Top Solution Authors