Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
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
Highlighted
Partner
Partner

Re: how to rearrange the months in non alphabetical order??

16 Replies
Highlighted
Partner
Partner

Re: how to rearrange the months in non alphabetical order??

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

Re: how to rearrange the months in non alphabetical order??

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

;

Highlighted
Valued Contributor III

Re: how to rearrange the months in non alphabetical order??

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

];

Highlighted
Partner
Partner

Re: how to rearrange the months in non alphabetical order??

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

];

Highlighted
Valued Contributor

Re: how to rearrange the months in non alphabetical order??

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

]

;

Highlighted
Not applicable

Re: Re: how to rearrange the months in non alphabetical order??

it still doesn't work

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

Highlighted
Valued Contributor

Re: how to rearrange the months in non alphabetical order??

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

];

Highlighted
MVP
MVP

Re: how to rearrange the months in non alphabetical order??

Remove [ ] around  - xbasedelivmonth

Highlighted
Valued Contributor III

Re: how to rearrange the months in non alphabetical order??

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'.........)