Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

convert string to readable date format

HassimDiallo
6 - Meteoroid

Hello!

i am having issues converting string data to date format. In my workflow i inputted multiple .txt files with the help of one input data tool by using wildcard "*". As the result all my columns are V-Wstring and doesn't allow select tool to change the data type to date. i would like to know how to convert my current column "posting Period to a readable data format for analysis.

 

One i am able to format the date, i will then sort by descending and use a cross tab to change column headers with the posting period and aggregate the values by sum.

 

HassimDiallo_0-1592921560772.png

HassimDiallo_1-1592921674191.png

 

5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

@HassimDiallo ,

 

The issue is that "12/2018" is not a date.  Dates look like:  "2018-12-01"

 

This formula should help you:

DateTimeParse(replace([Posting Period],"/","-01-"),"%m-%d-%Y")

It will create the date as of the first of the month.  Now you can create a real date.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
estherb47
15 - Aurora
15 - Aurora

Hi @HassimDiallo 

 

Mark's solution is on point. The date isn't in Alteryx date format, so it needs to be converted.

 

Whenever you bring in a csv, the columns come in as text. If the date is in Alteryx format, (e.g., 2010-01-31), then the Select tool will work.

Date formulas are a fantastic way to convert the field. You can also use Date Time Parse.

EstherB47_0-1592922957027.png


The format in your data is MM/yyyy (two digit month, followed by a slash, followed by 4 digit year.)

I love the Date Time PArse tool for its ease of use. I love the formula tool because you can manipulate multiple columns with one tool. Both are great options.

Let me know if that helps.

Cheers!

Esther

 

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@estherb47 ,

 

Given the time to learn Alteryx functions, I highly recommend avoiding the DateTimeTool. (See article:  https://community.alteryx.com/t5/Engine-Works-Blog/MarqueeCrew-s-Guide-to-Avoiding-Date-Frustration/...

 

My key issue with the tool is that the "formatting" guide uses non-standard abbreviations for the specifiers (e.g. "M" is month where %m is month as a specifier).  The tool works against learning.  The article referenced above helps users to identify the single or multiple patterns that exist in their data and creates parsing expressions that may (should) be useful in transforming their data.  It doesn't work for Month/Year combinations, but it could be modified to recognize that format.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
estherb47
15 - Aurora
15 - Aurora

@MarqueeCrew Thank you for the added insights.  I love learning from you

 

cheers!

esther 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@estherb47 ,

 

on behalf of @HassimDiallo  I am going to accept your solution too. It works!  Even if it isn't my approach, what works for you is good for me. 

cheers,

 

mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels