Difference of Year and month data
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi community,
I would like to ask how do we minus the date format below :
Thank you.
Solved! Go to Solution.
- Labels:
- Common Use Cases
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @SH_94
Please find the expected output.
datetimediff(datetimeparse(tostring([YearMonth1]),"%y%m"),datetimeparse(tostring([YearMonth2]),"%y%m"),"months")
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @SH_94
The below is the setting of the datatype.
Couldn't save the workflow as the below error is prompted.
Many thanks
Shanker V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @SH_94
Hope this helps!!!!
datetimediff(datetimeparse([YearMonth1],"%y%m"),datetimeparse([YearMonth2],"%y%m"),"months")
Many thanks
Shanker V
