Alteryx Designer Desktop Discussions

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

Change Column Date Format

navypoint16
8 - Asteroid

I have a group of columns with dates in the following format: 2016.01, 2016.02, 2016.03, etc.  What is the easiest way to update the headers of each column to the following format: Jan 2016, Feb 2016, Mar 2016, etc.?

5 REPLIES 5
Thableaus
17 - Castor
17 - Castor

Hi @navypoint16

 

Here's the solution that I thought of. Workflow appended.

 

Capturar.PNG

 

Cheers,

CharlieS
17 - Castor
17 - Castor

The formula to convert "2016.01" to "Jan 2016" is as follows:

DateTimeFormat(DateTimeParse([_CurrentField_],"%Y.%m"),"%b %Y")

 

I think a good way to apply that in renaming fields would be to use a Dynamic Rename tools with the following formula:

IF REGEX_Match([_CurrentField_],"\d{4}\.\d{2}") THEN
DateTimeFormat(DateTimeParse([_CurrentField_],"%Y.%m"),"%b %Y")
ELSE [_CurrentField_] ENDIF

 

That basically says that if the field name is in the format ####.## then apply the date rename. Otherwise, leave the field alone.

navypoint16
8 - Asteroid

Thank you! This is very helpful!

 

One question - in this case, X, Y, Z represents my entire dataset, but how can I replicate this without having to input my entire dataset?  In other words, I want to just drop the new dates into cells F5 through AP5 without impacting the dataset.

Thableaus
17 - Castor
17 - Castor

@navypoint16

 

Charlie's solution actually may work even better, so you don't need to transpose fields.

I don't think dropping new dates would impact your workflow, if you leave your Transpose Tool with "Dynamic or Unknown Fields" checked.

 

navypoint16
8 - Asteroid

Thank you both!  Charlie's solution worked great.

Labels