How to create a date without a day field in Alteryx

by Natasha Kurakina

Week 2 started for DS5 and we are already learning Alteryx! On Monday Chris Love was in charge of our training, and we learned a lot. So far I’m really enjoying working with Alteryx, especially the visual workflow feature and easy iterations.

 

 

The second day was full of hands-on, challenging exercises that helped me to explore more of Alteryx’s tools. At the same time not every process is straightforward and obvious (at least on the second day) so I want to share a tip about how to create a date without a day field.

 

Usually, when converting strings to dates, three parts of the date are needed: year, month, day. However, it is not always necessary to have a day field, as illustrated in this example, and it will also help to keep the workflow less complex.

 

The initial dataset came from a text file. Imported text data was split into columns and some data prep was done. Fields containing year and month were left as strings.

 

In the formula tool, a new column “Textdate” was created using the following formula.

 

Then in the DateTime tool, the string is converted into a date format using the custom incoming string format.

 

Alteryx will automatically add “01” as a day to the new converted date filed, so there is no need to add it anywhere explicitly.

 

This was the first tip from the first Alteryx week, so more tips to come!