How to get month name that sorts right from string containing partial date
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.
Created a calculated column and used the following case statement.
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…
and it sorts in the right order too!
Be the first to leave a comment
You must be Logged on to comment or reply to a post.