Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Month Sorting

Hi All

I have a list box with "Month(DateField)" value. I would like to sort my months in a cronological order (Jan - Dec).

How can i do this?

1 Solution

Accepted Solutions
Not applicable
Author

Hi Tumelo,

as you are using an expression in your listbox rather than a field, you'll need to use an expression to sort (as samapthbotla has said).

I would recommend actually creating a month field in your script, based on your existing code, so just


Month(DateField) AS Month

You can then just use the field in the listbox and as Jonathan has says, at that point you'll be able to use the standard number sorting option.

This way you are pushing the overhead back into the script, rather than in the UI.

Hope that helps

Joe

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Month() returns a dual value, so you should sort on numerical value to get a chronological order.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi,

In object properties sort tab select the dimension and in expression write below

=num(month(datefield))

Regards

$@M

Not applicable
Author

Hi Tumelo,

as you are using an expression in your listbox rather than a field, you'll need to use an expression to sort (as samapthbotla has said).

I would recommend actually creating a month field in your script, based on your existing code, so just


Month(DateField) AS Month

You can then just use the field in the listbox and as Jonathan has says, at that point you'll be able to use the standard number sorting option.

This way you are pushing the overhead back into the script, rather than in the UI.

Hope that helps

Joe

Not applicable
Author

Hi Guys

Thanks for all your replies. The month is ordered accordingly. But when concaternate another clculation to the field the months loses the ordering.

is there any way to keep the ordering after using &''& to add another calculation?