Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting of dates in charts

Hi All,

I have some charts which include year on year analysis, using the monthname of the date in question. What I want to do is sort them so that the months representing each year are side by side.

Below is a textual representation:

What I have now.

Jan 2012, Feb 2012, Mar 2012, Jan 2013, Feb 2013, Mar 2013.

What I want:

Jan 2012, Jan 2013, Feb 2012, Feb 2013, Mar 2012, Mar 2013

Any ideas on sorting would be gratefully received.

Thanks

Matt

1 Solution

Accepted Solutions
nilesh_gangurde
Partner - Specialist
Partner - Specialist

You can create the data island containing two fields, i.e.

For Example:

Load * inline [

DATE,SORT_ORDER

Jan 2012,1

Jan 2013,2

Feb 2012,3

Feb 2013,4

];

And then link this table with your Date Fileld in the datamodel.

then in Chart properties-> Sort Tab-> check mark the Expression and add SORT_ORDER there.

Hope this will help

-Nilesh

View solution in original post

5 Replies
nilesh_gangurde
Partner - Specialist
Partner - Specialist

You can create the data island containing two fields, i.e.

For Example:

Load * inline [

DATE,SORT_ORDER

Jan 2012,1

Jan 2013,2

Feb 2012,3

Feb 2013,4

];

And then link this table with your Date Fileld in the datamodel.

then in Chart properties-> Sort Tab-> check mark the Expression and add SORT_ORDER there.

Hope this will help

-Nilesh

tresesco
MVP
MVP

Try sort by expression:

=Month     // assuming there is a field called Month

Not applicable
Author

Write this expression in the Sort tab of the chart,

match('<FieldName>','Jan 2012', 'Jan 2013', 'Feb 2012', 'Feb 2013', 'Mar 2012', 'Mar 2013')

Regards,

Prabhu

Not applicable
Author

Thanks Nilesh, works well.

preminqlik
Specialist II
Specialist II

hi

use this expression in backend

num((Month(Date)))&'-'&Year(Date)                              as                    M_Y_SORT

in chart tab sort by expression :

ascending

=only({1}M_Y_SORT)

hope it helps

regards

Premhas