Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
montubhardwaj
Specialist
Specialist

Sorting Months (Jan-Dec) having data from many years.

Hi All,

I am little struck up with problem. Need your help. Here goes the description:

I have a filed "Months " which is having three years of data i.e like Jan-09,Aug-09,Mar-09,Dec-10,May-10,Mar-11,Jun-11 etc. I am using this field in the Dimension of Charts. It is working all fine but the problem is with sort. Ideally, it should show like Jan-09 through Dec-09 and then Jan-10 through Dec-10 . But now it is sorting in some random fashion. I have shown the problem below. Need to get it sorted properly.Any suggestions?

error loading image

3 Replies
Not applicable

You can create a field like this:

dual(Month(cNumDate) & '-' & Year(cNumDate), num(Year(cNumDate) & num(Month(cNumDate), '00'))) as cYearMonth


After this you can sort this field as Numeric Value. See attachment.

hector
Specialist
Specialist

Hi, i prefer this way

dual(Month(cNumDate) & '-' & Year(cNumDate), Year(cNumDate)*100 + Month(cNumDate)) as cYearMonth

then sort by numeric value

Rgds

montubhardwaj
Specialist
Specialist
Author

Thank You very much Guys!!

Your solution worked perfectly.... Kudos...!!! Yes