ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

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

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.


12 - Quasar



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().

6 - Meteoroid

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