Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Changing "Month" headers from alphabetical to chronological order

AlexSimmons
5 - Atom
 

Hi all,

 

I have taken a large set of data and extracted out the key information I require, I have transposed a MMM-YY value into just a month and then used cross tab to change these into headers for each month (see below example). The output of the headers are in alphabetical order whereas I want them to show in chronological month order i.e. Jan, Feb, Mar.

 

I've searched for a solution but nothing seems to cover this, apologies if I'm being stupid, I'm just starting to get to grips with Alteryx.

 

 

 

5 REPLIES 5
alexnajm
17 - Castor
17 - Castor

You will need to add in the numeric month beforehand using a Formula of sorts, then after you Crosstab you can remove the numbers with a Dynamic Rename!

binuacs
21 - Polaris

@AlexSimmons similar to @alexnajm suggestion, but here i converted the given MMM-YY to days and converted it back to MMM-YY in the heading using dynamic rename tool

image.png

AlexSimmons
5 - Atom

Thanks both for the responses, @binuacs when I opened your database it had a parse error, from what I can establish because there is a mixture of string and a date value? (could be wrong) but still provides the correct output, however when you use ToDate it classes the output as an integer rather than text (string) so it returns a null value. This subsequently causes the DynamicRename to fail for the same reason, I've run a similar logic with my own data and get the same outcome. 

 

ParseError.jpg

 

Appreciate your thoughts and guidance, thanks.

 

Alex.

 

 

binuacs
21 - Polaris

@AlexSimmons can you provide some sample data similar to your input which you were facing parse error?

apathetichell
19 - Altair

Dynamic Rename-> select all fields:

if !isnull(datetimeparse([_CurrentField_],'%B')) then trimleft(datetimeformat(datetimeparse([_CurrentField_],'%B'),'%m'),'0') else [_CurrentField_] endif

 

this asusmes that your months are in full month name (August/September) --- if they are like "Aug","Sep" --- use %b

 

and my assumption is that February is February the following year -> so you want it after December. I'm not resorting your column names here. because I do not want to make an assumption about your compare logic.

Labels
Top Solution Authors