Free Trial

Alteryx Designer Desktop Discussions

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

Parsing month and year to sort data

murthybhs
8 - Asteroid

Hello everyone,

 

I have a column with strings as Jan18, Apr16, Feb20, Jun17. How can I convert them into MMM-YYYY format so that I can sort them based on months. I mean Jan-2018, Apr-2016, Feb-2020, Jun-2017 by this. I tried a lot of pages but unable to find a solution that I need.

 

Thank you!

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @murthybhs ,

 

Use DateTimeParse tool to convert string to date later you can sort it. Later you can convert back to string.

 

Refer the link below for the tool

https://help.alteryx.com/2018.2/DateTime.htm

 

Here is the workflow to solve the problem.

atcodedog05_0-1600839858779.png

Considering provided input

atcodedog05_1-1600839880494.png

and expected output

atcodedog05_2-1600839922527.png

Hope this helps : )

 

If this helps please dont forget to mark the post as solution

 

Cheers and Happy Analyzing : )

MarqueeCrew
20 - Arcturus
20 - Arcturus

@murthybhs ,

 

i think that you need to create column as:

 

YYYY-MM. or 2020-09

 

 so that you can sort on that column.  

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
vizAlter
12 - Quasar

Hi @murthybhs — Try this solution:

 

1st you need to convert your date into Alteryx's date format (YYYY-MM-DD, like I used, 1st, DateTime tool), then you can do sorting on that new field, or calculations as well through Formula tool (if needed further).

 

However, you are looking for "MMM-YYYY" format which is in String datatype for Alteryx, so suggest you to add that field as well (like I used, 2nd, DateTime tool). Keep this 2nd new field till you want, then drop the 1st new field if you want in the end.

vizAlter_0-1600805200109.png

 

FYI — I have added 3 Sort tools, just to explain you more about the difference, let me know if any query.

 

Please mark it "Solved" or "Solved" with a Like if it resolved your query. This will help other users find the same answer/resolution.  Thank you.

grazitti_sapna
17 - Castor

Hi @murthybhs, try this.

 

grazitti_sapna_0-1600839405049.png

 

If this solves  your purpose please mark this post as solution.

 

Thanks.

 

Sapna Gupta
Labels
Top Solution Authors