Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to sort month by order?

hi to all,

Anyone of you explain how to sort the month by order.

My month dimension like below

month:

Apr

Aug

Jul

Jun

Sep

Oct

Nov

Mar

May

Jan

Feb

But I want month list like

Month

Jan

Feb

Mar

Apr

May

Jun

Jul

Aug

Sep

Nov

Dec

20 Replies
Master II
Master II

if the field have a date format, order are automaticly good as Num(Month)

Can you upload more explicity your problem?

To sort by Month (numeric) is necesary to have date format

That's because your month is a text field. Convert it to a proper month field during load. The month field is a dual with the month number as a value and a text representation of the 3 character month name.

LOAD...

     Month As MonthText,   // do you need this field?

     Month(Date#(Month & '2015', 'MMMYYYY')) As Month,

(the year used is irrelevant)

This month field should be sorted numerically (as is usual for dual values)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MVP
MVP

Sort expression: =Month(Date#(month,'MMM'))

PFA

Creator II
Creator II

Hi try this

LOAD * INLINE [

Month,Month_NO

Apr,4

Aug,8

Jul,7

Jun,6

Sep,9

Oct,10

Nov,11

Dec,12

Mar,3

May,5

Jan,1

Feb,2

];

Then in list box of Month Go to Sort Tab>Expression write the Month_NO

Thanks And Regards

Amarnath

Specialist II
Specialist II

Hi,

Please find the attachment.

Edit

month:

LOAD Month(Date#(Month,'MMM')) as month

INLINE [

Month,

Apr

Aug

Jul

Jun

Sep

Oct

Nov

Mar

May

Jan

Feb

];

Hi,

for the

Month(Date#(month,'MMM'))


approach (best done in the script) you might have to adjust your MonthNames variable to


SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

if that's not your local default.

regards

Marco

Specialist II
Specialist II

Copy the script and use Sortvalue descending in sort expression.

Load *, INLINE [

Month,Sortvalue

Apr,4

Aug,8

Jul,7

Jun,6

Sep,9

Oct,10

Nov,11

Dec,12

Mar,3

May,5

Jan,1

Feb,2

];

Partner
Partner

In Sort Tab, under expression:

wildmatch(Month_field,'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')

Partner
Partner

=wildmatch(capitalize(only({1}CalMonth)),'JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC')



Hope this will helps you..!!

Regards,

Mohammad