Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

need help parsing string field to get numbers

wtan
5 - Atom

I have a column that generally follows the following format: "# years, # months, # days". What I want to do is basically split the column into 3 new columns that have the number of years, months, and days. Normally, this could be done pretty quickly if the formatting stays consistent.

 

But there might not be an "s" if the numbers are just "1": "1 year, 1 month, 1 day".

 

Also, there need not be 3 numbers. For example: "2 years, 7 days" or "1 month, 28 days" or "5 years, 15 days" or "21 days".

 

I have a feeling this is going to need a long and complicated regex expression, so I really appreciate whatever help you can share.

1 REPLY 1
wtan
5 - Atom

Never mind, I just realized I can use datediff( ) on the appropiate columns for a much simpler solution.

Labels
Top Solution Authors