Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
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

16 Replies
rumeister
Contributor II
Contributor II

You just need to remove the [] around xbasedelivmonth

jagan
Luminary Alumni
Luminary Alumni

Hi,

In script try like this

LOAD

*,

Dual(xbasedelivmonth, Match(xbasedelivmonth, 'JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER')) AS Month

FROM DataSource;

Now in Chart/List box Select Numeric in Sort tab.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hi Ruhan,

thanks it worked,but the ranks are shown ,how do I get the month names.

eg: if you see sheet 5 in my file attached file how do I pull the rearranged names?? like in my list box delivery details I want the months to be present in the Jan to Dec order... how to do it??Please help.

sasikanth
Master
Master

Write this in that list box properties-->sort tab-->expression

match(xbasedelivmonth,'JANUARY','FEBRUARY','MARCH','APRIL','MAY','JUNE','JULY','AUGUST','SEPTEMBER','OCTOBER','NOVEMBER','DECEMBER')

rumeister
Contributor II
Contributor II

Capture.JPG.jpg

hic
Former Employee
Former Employee

Ouch!!! It hurts to see that so many people suggest an inline table to solve this problem...

An inline table will work, but it is a clumsy method. It is much better to interpret the month name so that it gets a dual format that automatically gets sorted correctly . Here's how you should do it:

First, make sure that you have the environment variables in the beginning of the script:

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET LongMonthNames= 'JANUARY;FEBRUARY;MARCH;APRIL;MAY;JUNE;JULY;AUGUST;SEPTEMBER;OCTOBER;NOVEMBER;DECEMBER';


Then, you can just use the following to interpret the month names. MMM means short month names, MMMM means long month names.

Month(Date#(Month,'MMMM')) as Month

No inline table is needed.


HIC

Not applicable
Author

Thanks a lot all of you for helping me out.

new learning for me.