Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Converting a year (YYYY) in string format, to a date field

arundaka02
8 - Asteroid

Hi everyone

 

Within my table I have the following Year column and I want to convert it to the Date column:

 

Year (string format)Date (date format) (desired format)
202001/01/2020
202101/01/2021
202201/01/2022
202301/01/2023
202401/01/2024

 

I want to do this so I can utilise line chart visualisations in Power BI. 

 

I've tried using the DateTime tool but can't locate an incoming string YYYY option to convert. I'm thinking the Formula tool can resolve this and help with formula type would be appreciated!

 

Can anyone help?

 

Thanks
KA

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@arundaka02 ,

 

 how about trying:

"01/01/" + [year]

or try

 

 

"01/01/" + ToString([year])

 

 cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
ImadZidan
12 - Quasar

Hello @arundaka02 ,

 

see example in the workflow.

 

Hope it helps.

 

If you are looking for 01/01/2020 or similar as a date output, I am afraid this is not possible.

 

Dates in Altyrex are all set to yyyy-mm-dd format. 

arundaka02
8 - Asteroid

Thanks @ImadZidan 

 

I've just learnt that this is the case when I've converted it to a date format with DateTime! 

 

I can now however complete linear visualisations in Power BI. thanks @MarqueeCrew 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@arundaka02  You're quite welcome

Alteryx ACE & Top Community Contributor

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