In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #4: Date Parsing

margiecaina
6 - Meteoroid

my solution

snothando_hlongwane
8 - Asteroid

Challenge #4 Solution

thomasduong
8 - Asteroid

Here is my solution to Challenge #4

Spoiler
Screenshot 2024-12-17 111848.png
Spainey
9 - Comet

A nice regex solution to this date problem. 

Spoiler
Community Challenge 4 Solution.png

I have used the Regex_Match and Regex_Replace functions to identify specific patterns in the data and then pull out only the data I needed to a raw date column. After this, I had 2 different formats of dates, so did a different DateTimeParse operation on each pattern.

Date_raw = 

IF Contains([Field_1], "-")
THEN UpperCase(REGEX_Replace([Field_1], ".*?(\d+-[A-Za-z]+-\d+).*", "$1"))
ELSEIF REGEX_Match([Field_1], ".*?[A-Za-z]{3} \d+,? \d{4}.*")
THEN REGEX_Replace([Field_1], ".*?([A-Za-z]{3}) (\d+),? (\d{4}).*", "$2-$1-$3")
ELSE ""
ENDIF


Date

IF REGEX_Match([Date_raw], "\d+-[A-Z]+-\d{4}")
THEN DateTimeParse([Date_raw], "%d-%b-%Y")
ELSEIF REGEX_Match([Date_raw], "\d+-[A-Z]+-\d{2}")
THEN DateTimeParse([Date_raw], "%d-%b-%y")
ELSE ""
ENDIF
cmoussa
8 - Asteroid

WF.png

 

martinson
11 - Bolide

nICE 

Cheers,
martinson

LinkedIN

Bulien
Darby_Lehane
6 - Meteoroid
Spoiler
Screenshot 2025-01-21 124420.pngScreenshot 2025-01-21 124420.png
Dominic_Brady
8 - Asteroid

My solution!

Jfoss
7 - Meteor

fun RegEx solution. I don't use them very often but great example of how powerful they can be. 

holly_jones12
7 - Meteor
Spoiler
 

A tricky one to get my head round with the RegEx