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

How do I use DateTimeLastOfMonth() for the previous current month?

price_is_right
6 - Meteoroid

I tried putting a function [  DateTimeAdd(DateTimeToday(),-1,'month')  ] inside the DateTimeLastOfMonth() function but it states that there are too many arguments ... 

What I'm really looking for is an easy way to output the last day of the month from the month previous to this month.  (As of time of writing ... 12/31/2018).

I bet this is super simple but I'm not able to obtain it easily.

Thanks!

2 REPLIES 2
neilgallen
12 - Quasar

@price_is_right

 

easiest way is datetimeadd(datetimefirstofmonth(),-1,'days').

 

Reset back to the first day of this month and go back one day. This is best because the last of month function will vary based on the number of days in a month (30 vs 31).

 

Lastly, the datetimelastofmonth() is not really a function, per se, as it cannot contain parameters. It's only used to determine the last day of the current month. Same goes for datetimefirstofmonth().

price_is_right
6 - Meteoroid

Thanks Neil!  I was unaware that the "LastofMonth()" wasn't really a function.  

Labels