Free Trial

Alteryx Designer Desktop Discussions

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

Extract dates from a column

sanoopmnr
5 - Atom

Hi all,

 

Could anyone help me to extract month (Jan,Feb etc) and year from below input.

sanoopmnr_0-1651417025830.png

 

5 REPLIES 5
DataNath
17 - Castor
17 - Castor

Assuming it’s always the 3 letter abbreviations then selecting the parse method and using the below expression should work. Also make sure that you have ‘case insensitive’ ticked:

 

(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)

DataNath
17 - Castor
17 - Castor

Just noticed you asked for the year as well. Can easily get that by using: (\d{4}).

StephaneP
Alteryx Alumni (Retired)

Hello @sanoopmnr ,

 

As explains by @DataNath you can use the RegEx tool. This is very powerful.

 

Another way of doing it is to use the Find & Replace Tool. That have an option that store the find value in a dedicated column. It looks anywhere in the field and can be case sensitive or not.

StephaneP_0-1651428804410.png

Then if you have a mapping table with the list of the month you are looking for it will generate the list of any of this month found in the Field1 column.

StephaneP_2-1651428871778.png

So I have added 1 for the month and 1 for the year.

StephaneP_3-1651428962646.png

 

I have also added the RegEx @DataNath example for you to compare.

 

Why use 1 or the other?

Up to you.

RegEx are more advanced and can not be implement/maintain by everyone but are far more powerful.

You also need to hardcoded the list in the tool.

 

Find & Replace are more beginner usage and then is more maintenable. I also like the fact that the mapping table is external which is also more easy to maintain.

 

So once more with Alteryx regarding your level/ team level and who is going to maintain you can always find the solution that best fit your need.

 

Enjoy!

 

Stéphane Portier
Sales Engineer
Alteryx
sanoopmnr
5 - Atom

Awesome! This solved my issue. Thank you @StephaneP for taking time to build this workflow.

StephaneP
Alteryx Alumni (Retired)

and thanks to @DataNath also 🙂

Stéphane Portier
Sales Engineer
Alteryx
Labels
Top Solution Authors