Hello everyone,
I have a column with strings as Jan18, Apr16, Feb20, Jun17. How can I convert them into MMM-YYYY format so that I can sort them based on months. I mean Jan-2018, Apr-2016, Feb-2020, Jun-2017 by this. I tried a lot of pages but unable to find a solution that I need.
Thank you!
Solved! Go to Solution.
Hi @murthybhs ,
Use DateTimeParse tool to convert string to date later you can sort it. Later you can convert back to string.
Refer the link below for the tool
https://help.alteryx.com/2018.2/DateTime.htm
Here is the workflow to solve the problem.
Considering provided input
and expected output
Hope this helps : )
If this helps please dont forget to mark the post as solution
Cheers and Happy Analyzing : )
i think that you need to create column as:
YYYY-MM. or 2020-09
so that you can sort on that column.
cheers,
mark
Hi @murthybhs — Try this solution:
1st you need to convert your date into Alteryx's date format (YYYY-MM-DD, like I used, 1st, DateTime tool), then you can do sorting on that new field, or calculations as well through Formula tool (if needed further).
However, you are looking for "MMM-YYYY" format which is in String datatype for Alteryx, so suggest you to add that field as well (like I used, 2nd, DateTime tool). Keep this 2nd new field till you want, then drop the 1st new field if you want in the end.
FYI — I have added 3 Sort tools, just to explain you more about the difference, let me know if any query.
Please mark it "Solved" or "Solved" with a Like if it resolved your query. This will help other users find the same answer/resolution. Thank you.
Hi @murthybhs, try this.
If this solves your purpose please mark this post as solution.
Thanks.