Alteryx Designer Desktop Discussions

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

How to convert Date into month =IF(A2>0,TEXT(A2,"YYYY")&"-"&TEXT(A2,"MM"),0)

Kinetic_analytics
11 - Bolide

Hello Community:

How to convert Excel formula into Alteryx formula?

 

=IF(A2>0,TEXT(A2,"YYYY")&"-"&TEXT(A2,"MM"),0)

 

Appreciate your response.

 

Thanks

 

2 REPLIES 2
Kenda
16 - Nebula
16 - Nebula

Hi @Kinetic_analytics 

 

If you read your date field into Alteryx and it already recognizes it as a date ("YYYY-MM-DD"), you should be able to create a new string field with a formula tool with this expression: 

datetimeformat([Date], "%Y-%m")

 

 

On the other hand, if you read your field into Alteryx and it still looks like "MM/DD/YYYY" then try this expression to create a string field using a formula tool: 

datetimeformat(DateTimeParse([Date],"%m/%d/%Y"), "%Y-%m")

 

 

If you want more details on date/time formatting in Alteryx, see this article: https://help.alteryx.com/20213/designer/datetime-functions  

Kinetic_analytics
11 - Bolide

Thank you.

Labels