Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

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
17 - Castor
17 - Castor

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
17 - Castor
17 - Castor

Happy to help!

Labels