Free Trial

Alteryx Designer Desktop Discussions

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

DateTime Functions - Identifying the Last Day of The Month

CPelkofer
5 - Atom

Hi There,

 

I am creating a new column in the dataset for Termination dates to be the end of that month in time "Termination Month", but if the termination date was already the last day of that month I want it to show up as the last day of the following month. I know I need an IF function in lieu of the DateTime, but I am having trouble just purely identifying the termination date being the last day of that month. I have attached a sample output of what I am trying to accomplish, thanks in advance!

 

CPelkofer_0-1651166608089.png

 

IF (date equals last day of that month)

THEN (its reporting 2 months ahead minus one day, to get the termination month reported as the following month)

ELSE (reporting the last day of the month for the Termination Date)

ENDIF

6 REPLIES 6
patrick_digan
17 - Castor
17 - Castor

@CPelkofer I would first convert the term date to an alteryx date, and then do a formula like:

If Left(DateTimeTrim([Term Date (Date)],"lastofmonth"),10) = [Term Date (Date)] 
then 
DateTimeTrim(DateTimeAdd([Term Date (Date)],1,"days"),"lastofmonth")
else
DateTimeTrim([Term Date (Date)],"lastofmonth")
endif

The left 10 is necessary as DateTimeTrim lastofmonth adds the time component

.

patrick_digan_0-1651170015468.png

 

CPelkofer
5 - Atom

Hi Patrick,

 

I am getting a parse error for this due to me not giving you how the actual figures were formatted in my data compared to the example I attached to my question. I apologize. The actual format they are currently are in are shown below.

 

CPelkofer_0-1651778538455.pngCPelkofer_1-1651778567373.png

 

Luke_C
17 - Castor
17 - Castor

Hi @CPelkofer 

 

It looks like your values are already in date format, so no need to parse them. You might just need to update the data type to be Date if it isn't already.

patrick_digan
17 - Castor
17 - Castor

@CPelkofer No worries! If they're already in that date format, you can just change all the references of [Term Date (Date)] to [Termination Date]. You could then remove that first formula that was creating the Term Date (Date) field.

CPelkofer
5 - Atom

Thanks for the Help!

CPelkofer
5 - Atom

Thanks for the help!

Labels
Top Solution Authors