Alteryx Designer Desktop Discussions

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

Convert String date to date

veekay
7 - Meteor

Hi There

 

In my database I have a string date values as Q1 2014, Q2 2014 etc. Is there a way to convert them to date values so that I can use these for analysis/time series calculations?

 

Thanks

 

Veekay

2 REPLIES 2
BenMoss
ACE Emeritus
ACE Emeritus

 

You can convert string dates to an actual date field using the 'datetime' tool, which supports a number of different incoming formats, and where Alteryx hasn't pre-built, in most instances you can use a 'custom' statement to capture your incoming date structure.

 

However, quarter is not one of those supported.

 

What I would advise you do is:

 

Split your field on the space character. This will leave you with two fields, one which is Q1 (quarter) and one that is 2014 (year).

 

Now you can build out a simple formula tool to develop your date.

 

[Year]+IF [Quarter] = "Q1" THEN "-01-01" ELSEIF [Quarter] = "Q2" THEN "-04-01" ELSEIF [Quarter] = "Q3" THEN "-07-01" ELSE "-10-01" ENDIF

veekay
7 - Meteor

This worked like a charm!

 

Thanks Ben 

Labels