Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Last date of Previous month

Aravindc
5 - Atom

Hi All,

 

I;m fairly new to alteryx and i'm trying to build a workflow . Is there a formulae which i can use to find the last date of previous month?

 

Thanks in advance and happy new year:)

4 REPLIES 4
Emil_Kos
17 - Castor
17 - Castor

Hi @Aravindc,

 

You need to use this formula:

 

DateTimeAdd(DateTimeFirstOfMonth(),-1,'days')

 

Datetimefirstofmonth() will provide you with the first day of the current month and the formula I have prepared will remove 1 day from this date.

 

I prepared the workflow for you.

 

Please mark as a solution if this was helpful!

AngelosPachis
16 - Nebula

Hi @Aravindc ,

 

There are many ways to achieve this, usually I like to play with an embedded function within Alteryx called Datetimetrim, which given the correct parameters will return you the last day of the month

 

AngelosPachis_0-1609407880057.png

 

I've mocked a workflow with two possible ways for you, I hope that's helpful

 

Regards,

 

Angelos

 

messi007
15 - Aurora
15 - Aurora

@Aravindc,

 

You can use DateTimeToday as well 🙂

DateTimeAdd(DateTimeTrim(DateTimeToday(),'FirstOfMonth'),-1,'day')

 

Hope this helps,

 

Regards,

jpscoralick
8 - Asteroid

Perfect solution, @messi007. Thanks a lot!

...and to cut the "time part" and keep just the "date part" (YYYY-MM-DD hh:mm:ssit can be used "Left" function as it follows:

Left(DateTimeAdd(DateTimeTrim(DateTimeToday(),'FirstOfMonth'),-1,'day'),10)

 

Regards

Labels