Alteryx Designer Desktop Discussions

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

Changing a numeric variable to date variable

dkberry
6 - Meteoroid

I currently have a numeric variable that represents a date. ex Feb 20, 2019 is called 20190220.

 

I would like to change this field so that Alteryx would recognize 20190220 as a date and not a number. I would like to then create a new date field that contains year and month or month and year, order isn't important so long as Alteryx sees a date. So 201902 would be transitioned to Feb-2019 (or any format that Alteryx would recognize as month/year). Thanks in advance for any help.

5 REPLIES 5
yalmar_m
11 - Bolide

Hi @dkberry,

 

I think a combination of the Select tool (to change the number to string), DateTime tool (to parse the number to a date) and the formula tool (to create the month-year you want to have) would work.

Please find my solution attached.

 

 

Best,

Yalmar

 

cplewis90
13 - Pulsar
13 - Pulsar

@dkberry here is a workflow that does what you are asking. It converts the date using the datetime tool and then a formula tool to create the month year field.

dkberry
6 - Meteoroid

Thanks so much. When I run your solution I create a variable similar to Apr 2018. The issue I'm now having is I'm unable to sort accurately by this new month variable. Is there a way to create a variable that resembles Apr 2018 but Alteryx will recognize as a date variable?

yalmar_m
11 - Bolide

Unfortunately you can't, you might want to sort on the Month (resulting from the DateTimeMonth([Date]) formula).

The format you described in sorted alphabetically.

cplewis90
13 - Pulsar
13 - Pulsar

@dkberry I have revised my solution to accommodate for this.

Labels