We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

General Discussions

Discuss any topics that are not product-specific here.

Date Formula

JACKIEC1992
6 - Meteoroid

I need help with a formula that filters by any month other than the current month. So for this example (October) then changes any dates that are from previous months to the most current date. In this example - the formula would find the September date and replace it with the most current month. Any recommendations?

 

1 REPLY 1
DataNath
16 - Nebula

Hi @JACKIEC1992, is this what you're looking for? The incoming data I copied from your screenshot:

 

DataNath_0-1665523802483.png

 

Alteryx deals with dates in YYYY-MM-DD format and so to deal with your incoming MM-DD-YY format, we need to use the DateTimeParse() function. In doing so, I check that the month of your incoming date is the same as the month of today's date (to give current month). The '!=' denotes 'not equal to' and so you can see the September day comes out of the true anchor:

 

DataNath_1-1665523882742.png

 

And the October dates come out of the False (bottom) anchor, as they are the current month:

 

DataNath_2-1665523909309.png

 

To those that come out of the top (True) anchor and aren't in the current month, I've then trimmed off the first 2 characters of the string which represent the month and added the current month to that trimmed string:

 

DataNath_3-1665523955961.png

 

If there's any issues or you need further clarification then please do shout up.

Labels