Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Finding the Last Day of the Previous Month

BrandonS4
8 - Asteroid

Hello all!  I am trying to find the correct formula to find the last day of the previous month.  I am running a report that will calculate DSO and I need to multiply by the number of days in the previous month.  Any help would be appreciated!

 

Thanks!

11 REPLIES 11
KLAMB
6 - Meteoroid

How could this be modified to pull first day of prior month (ie, 2021-07-01).

BrandonS4
8 - Asteroid

Previous Month = DateTimeAdd([OriginalDate],-1,"month")

FirstOfPreviousMonth = DateTimeAdd([Previous Month], 1-DateTimeDay([Previous Month]), "days")

LastOfPreviousMonth = DateTimeAdd([OriginalDate], 0-DateTimeDay([OriginalDate]), "days")

Labels