Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Digvijay_Singh

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
sunny_talwar

Try this

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

Digvijay_Singh

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

];

Anonymous
Not applicable
Author

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

sunny_talwar

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

Fiscal and Standard Calendar generation

zebhashmi
Specialist
Specialist

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

Anonymous
Not applicable
Author

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

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

Anonymous
Not applicable
Author

Thanks Sunny! I'll give it a try.

juraj_misina
Luminary Alumni
Luminary Alumni

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

Digvijay_Singh

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