Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
jajati_k_dev
New Contributor II

Sorting of Months

Hi!

Am new to QlikView and have recently started exploring the tool. It's mostly on trial and error method.

Am working on a Line Chart where am trying to sort Month by arranging them in the following order; Nov, Dec, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct.

So far I haven't had any luck in achieving the desired result. Please assist.


Regards,

Dev

1 Solution

Accepted Solutions
Highlighted
Digvijay_Singh
Honored Contributor III

Re: Sorting of Months

One way is to create sort order in script before any other script is executed for a dimension field, like this -

Load Dual(Month,RowNo()) as Month inline [

Month

Feb,

Mar,

Apr,

May,

Jun,

Jul,

Aug,

Sep,

Nov,

Dec ];


TablefromScript:

Load *, Month(Date) as Month inline [

Date, Value

01/01/2018, 2000

03/01/2018, 4000

09/01/2018, 6000

02/01/2008, 8000

04/01/2008, 1000

];

View solution in original post

10 Replies
Highlighted

Re: Sorting of Months

Try this

Only({1} Date#(MonthField, 'MMM'))

Highlighted
Digvijay_Singh
Honored Contributor III

Re: Sorting of Months

One way is to create sort order in script before any other script is executed for a dimension field, like this -

Load Dual(Month,RowNo()) as Month inline [

Month

Feb,

Mar,

Apr,

May,

Jun,

Jul,

Aug,

Sep,

Nov,

Dec ];


TablefromScript:

Load *, Month(Date) as Month inline [

Date, Value

01/01/2018, 2000

03/01/2018, 4000

09/01/2018, 6000

02/01/2008, 8000

04/01/2008, 1000

];

View solution in original post

Highlighted
jajati_k_dev
New Contributor II

Re: Sorting of Months

Hi Sunny,

Thanks for responding to my query.

I tried the expression suggested and ended up as below;

For me, fiscal year starts with Nov and ends with Oct.

I need the months to be arranged in similar order.

ScreenHunter_01 Feb. 23 23.25.jpg

Highlighted

Re: Sorting of Months

Then I suggest fixing it in the script using a Fiscal Year Master calendar

Fiscal and Standard Calendar generation

Highlighted
zebhashmi
Valued Contributor

Re: Sorting of Months

Only({YourMonthField = {">=Nov<=Oct"}}YourMonthField)

Highlighted
jajati_k_dev
New Contributor II

Re: Sorting of Months

Hello Hashim! Am retaining an error with the expression you have suggested.

Will it be possible for you to send a .qvd file?

jajati_k_dev
New Contributor II

Re: Sorting of Months

Thanks Sunny! I'll give it a try.

Highlighted
Luminary
Luminary

Re: Sorting of Months

Hi,

Digvijay's solution is perfect, just a clarification:

1. You need to load the first table BEFORE you load your Month field.

2. The Month field in this table must have the same name as in calendar/fact table.

3. You can safely drop the first table at the end of script.

4. When creating chart go to sort settings for the month field and select "load order"

Hope this helps.

Juraj

Highlighted
Digvijay_Singh
Honored Contributor III

Re: Sorting of Months

Yup, You explained it perfectly.  If you feel you got what is needed, you may close this thread by marking correct/helpful answers.