Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ashokraju
Contributor II
Contributor II

Sorting

I have a colomn called 'BookingPeriod' values like jan 09,feb 09 to dec 16 in irregular order. How to sort these values in ascending order like jan 09 to dec 16.

9 Replies
tamilarasu
Champion
Champion

Hi Ashok,

Try this as sort expression in sort tab.

=Date#(BookingPeriod,'MMM YY')

Chanty4u
MVP
MVP

try below

using match   ...sort tab expression.

=Match(MonthYear,'jan09......'dec16')

pathiqvd
Creator III
Creator III

Hi,

   Try This,

Match(CAPITALIZE(LEFT(TRIM(fieldnname,3)),

$(=chr(39) & Replace(MonthNames, ';', chr(39) & ',' & chr(39)) & chr(39)))

+ (RIGHT(TRIM(fn),2) * 11)

ashokraju
Contributor II
Contributor II
Author

I want dynamically. In future previous years will come that time this will not works.

ashokraju
Contributor II
Contributor II
Author

hi..it is not working

tamilarasu
Champion
Champion

I did a test in a sample file and it's working fine. If possible, share your application.

Anil_Babu_Samineni

This should work, When you say it is not working you may share sample data

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ninnartx
Creator
Creator

Maybe check and see if your field BookingPeriod is stored as text or date format first?

sunny_talwar

May be a slight variation of what Tamil has provided:

In the script:

Date(Date#(KeepChar(Upper(BookingPeriod), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'), 'MMMYY'), 'MMM-YY') as BookingPeriod

or front end (dimension or sorting expression)

Date(Date#(KeepChar(Upper(BookingPeriod), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'), 'MMMYY'), 'MMM-YY')