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

how to rearrange the months in non alphabetical order??

Hi all,

I have a field which has all the month names arranged in almost  alphabetical order .how to change it to the order starting from Jan to Dec?? CAn anyone please help me out??

Regards,

Sahana

1 Solution

Accepted Solutions
16 Replies
rumeister
Contributor II
Contributor II

Hi Sahana

Here is a solution you can use:

It just depends on what your month field looks like. For example, if your months are spelled out (January, February etc.) you will have to spell it out in the inline load below as well. Also keep in mind that QV is case sensitive so if your months are spelled JANUARY, you will have to use all caps below as well. Hope this helps.

Month_Rank:

LOAD * Inline [

[Your Month Field Name], MonthRank

JAN, 1

FEB, 2

MAR, 3

APR, 4

MAY, 5

JUN, 6

JUL, 7

AUG, 8

SEP, 9

OCT, 10

NOV, 11

DEC, 12

];

Just sort by MonthRank in ascending order.

Not applicable
Author

Hi Ruhan,

Thanks for the response.

As you said I have given as shown below,but some syntax issue is there I guess,can you please help ??

Month_Rank:

LOAD * Inline

[xbasedelivmonth] ,MonthRank

JANUARY, 1

FEBRUARY, 2

MARCH, 3

APRIL, 4

MAY, 5

JUNE, 6

JULY, 7

AUGUST, 8

SEPTEMBER, 9

OCTOBER, 10

NOVEMBER, 11

DECEMBER, 12

;

sasikanth
Master
Master

load * Inline

[

[xbasedelivmonth] ,MonthRank

JANUARY, 1

FEBRUARY, 2

MARCH, 3

APRIL, 4

MAY, 5

JUNE, 6

JULY, 7

AUGUST, 8

SEPTEMBER, 9

OCTOBER, 10

NOVEMBER, 11

DECEMBER, 12

];

rumeister
Contributor II
Contributor II

Month_Rank:

LOAD * Inline [

xbasedelivmonth ,MonthRank

JANUARY, 1

FEBRUARY, 2

MARCH, 3

APRIL, 4

MAY, 5

JUNE, 6

JULY, 7

AUGUST, 8

SEPTEMBER, 9

OCTOBER, 10

NOVEMBER, 11

DECEMBER, 12

];

Anonymous
Not applicable
Author

You need to add square bracket in inline

Month_Rank:

LOAD * Inline [

[xbasedelivmonth] ,MonthRank

JANUARY, 1

FEBRUARY, 2

MARCH, 3

APRIL, 4

MAY, 5

JUNE, 6

JULY, 7

AUGUST, 8

SEPTEMBER, 9

OCTOBER, 10

NOVEMBER, 11

DECEMBER, 12

]

;

Not applicable
Author

it still doesn't work

I have attached my file you can have a look in the script on tab 3.

Anonymous
Not applicable
Author

try below,

newmonth:

load * Inline

[

xbasedelivmonth,MonthRank

JANUARY, 1

FEBRUARY, 2

MARCH, 3

APRIL, 4

MAY, 5

JUNE, 6

JULY, 7

AUGUST, 8

SEPTEMBER, 9

OCTOBER, 10

NOVEMBER, 11

DECEMBER, 12

];

tresesco
MVP
MVP

Remove [ ] around  - xbasedelivmonth

sasikanth
Master
Master

Juts Remove Brackets ([,])

fro the field [xbasedelivmonth] like xbasedelivmonth

or else

with out making it you can use match function in sort tab-->Expression

like match(xbasedelivmonth,'JAN','FEB','MAR'.........)