In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Difference of Year and month data

SH_94
11 - Bolide

Hi community,

 

I would like to ask how do we minus the date format below :

SH_94_0-1673936489125.png

Thank you.

 

6 REPLIES 6
ShankerV
17 - Castor

Hi @SH_94 

 

This can be achieved with the help of formula tool.

 

Use datetimeparse to covert to alteryx format and then use datetimediff() to find the months diff.

 

Many thanks

Shanker V

 

 

ShankerV
17 - Castor

Hi @SH_94 

 

Please find the expected output.

 

ShankerV_0-1673937080613.png

 

datetimediff(datetimeparse(tostring([YearMonth1]),"%y%m"),datetimeparse(tostring([YearMonth2]),"%y%m"),"months")

 

ShankerV_1-1673937093454.png

 

If this helps, please like this post and mark it as a solution. If you have any other questions, please let us know.

 

Many thanks

Shanker V

 

 

SH_94
11 - Bolide

Hi @ShankerV ,

 

Can i have the wokflow ? As i want to see the setting of datatype/

ShankerV
17 - Castor

Hi @SH_94 

 

The below is the setting of the datatype.

ShankerV_0-1673937495050.png

 

Couldn't save the workflow as the below error is prompted.

ShankerV_0-1673937542944.png

 

 

Many thanks

Shanker V

 

ShankerV
17 - Castor

Hi @SH_94 

 

If your datatype is string already, the below formula will work.

 

datetimediff(datetimeparse([YearMonth1],"%y%m"),datetimeparse([YearMonth2],"%y%m"),"months")

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @SH_94 

 

Hope this helps!!!!

 

ShankerV_0-1673937706730.png

 

datetimediff(datetimeparse([YearMonth1],"%y%m"),datetimeparse([YearMonth2],"%y%m"),"months")

 

ShankerV_1-1673937716854.png

 

ShankerV_2-1673937749073.png

 

Many thanks

Shanker V

 

 

 

 

Labels
Top Solution Authors