Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Convert numbers into Year and Month

45179902
8 - Asteroid

I have some data that looks like this: 2203

 

I want the 22 to be converted to 2022 and 03 to be converted to Feb (note that it should be the prior month)

 

So the newly generated columns should be 2022 under Year and Feb under Month.

 

Updated:

 

Since @Qiu has asked me: for 2201, the outputs should be 2021 under year and Dec under month.

6 REPLIES 6
RolandSchubert
16 - Nebula
16 - Nebula

Hi @45179902 ,

 

you could convert the number to a string, a the  leading "century" and use DateTimeParse and DateTimeFormat to create the required date format.

 

2022-04-11_09-27-23.jpg

 

I've splitted it to a 3 formulas. In the first formula, you could add a condition, if there are date from 19xx. 

 

Let me know if it works for you.

 

Best,

 

Roland

Qiu
20 - Arcturus
20 - Arcturus

@45179902 
What will be result for 2201? 😁
Basically it will be combinations of DateTime Functions.

https://help.alteryx.com/20214/designer/datetime-functions

0411-GeorgeL.PNG

45179902
8 - Asteroid

@Qiu That's a good question. In that case, should be 2021 and Dec.

atcodedog05
22 - Nova
22 - Nova

Hi @45179902 

 

Here is my take on it.

 

workflow:

atcodedog05_0-1649663221733.png

 

Hope this helps : )

 

atcodedog05
22 - Nova
22 - Nova

Hi @45179902 

Also here are some resources on the tools used

https://help.alteryx.com/20214/designer/datetime-functions
https://community.alteryx.com/t5/Engine-Works/DateTime-Functions-Cheat-Sheet/ba-p/844353


Hopefully, you learnt something new today which will help you in the future : )

 

Hope this helps : )

Qiu
20 - Arcturus
20 - Arcturus

@45179902 
Thank you for the confirmation.
Maybe we can do like this.

0411-GeorgeL-1.PNG

Labels