Skip to Content

If you have Year and Month (partial date) as a string in a HANA view (as given below) but need the month name in the correct sorting order, you can do the following.

YYYY_MM.png

     Created a calculated column and used the following case statement.

Case.png

Formula in text

case(rightstr(“Year_and_Month”,2),’01’,’01-Jan’,’02’,’02-Feb’,’3′,’03-Mar’,’04’,’04-Apr’,’05’,’05-May’,’06’,’06-Jun’,’07’,’07-Jul’,’08’,’08-Aug’,’09’,’09-Sep’,’10’,’10-Oct’,’11’,’11-Nov’,’12’,’12-Dec’,’no’)

     This gives the following output…

Output.png

and it sorts in the right order too!

Sorted_Output.png

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply