Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
vishalgoud
Creator III
Creator III

issue with the Custom Sorting on Y axis in bar chart ?

Hello all ,

we are showing the last 3 months count in the bar chart using a Calculated Dimension .

So in order to customize y axis months order am using the Match function but which is not working as Expected.

Please help me , its kind of urgent. I want the Months will be in order like Mar-2016,Feb-2016,Jan-2016 etc

Dimension : =left(SubField(MONTH_YEAR,'-',1),3) & '-' & Right(SubField(MONTH_YEAR,'-',2),2)

in the Sort tab -- Expression -- ascending

= Match(MONTH_YEAR,'Apr-2014','May-2014','Jun-2014','Jul-2014','Aug-2014','Sep-2014','Oct-2014','Nov-2014','Dec-2014',
'Jan-2015','Feb-2015','Mar-2015','Apr-2015','May-2016','Jun-2015','Jul-2015','Aug-2015','Sep-2015','Oct-2015','Nov-2015','Dec-2015',
'Jan-2016','Feb-2016','Mar-2016')
.

tried with the Mix Match and Wild match also.

1 Solution

Accepted Solutions
sunny_talwar

May be do this in the script:

LOAD Date(MonthStart(Date#(MONTH_YEAR, 'MMM-YYYY')), 'MMM-YY') as MONTH_YEAR

If you only have first three letter of every month, then you need MMM. If you have complete month names, use MMMM.

Once you make the above change, you should be good to use this as your dimension and sort numerically.

View solution in original post

5 Replies
sunny_talwar

May be try this:

= Match(MONTH_YEAR,'Apr-14','May-14','Jun-14','Jul-14','Aug-14','Sep-14','Oct-14','Nov-14','Dec-14',
'Jan-15','Feb-15','Mar-15','Apr-15','May-16','Jun-15','Jul-15','Aug-15','Sep-15','Oct-15','Nov-15','Dec-15',
'Jan-16','Feb-16','Mar-16')

But for how long are you going to hard code these values. I suggest changing your MONTH_YEAR field in the script to help QlikView or Qlik Sense read it as a dual field and then you can sort it numerically. How does MONTH_YEAR field look today?

UPDATE: Disregard my 1st suggestion.

sunny_talwar

It seems your MONTH_YEAR field looks like this

January-2016

February-2016

and so on

If that's true than try this in the script:

SET LongMonthNames = 'January;February;March;April;May;June;July;August;September;October;November;December';

LOAD Date(MonthStart(Date#(MONTH_YEAR, 'MMMM-YYYY')), 'MMM-YY') as MONTH_YEAR

vishalgoud
Creator III
Creator III
Author

Hi Sunny,

thanks a lot for the Quick Reply,

Right now the Month_year Field is looking like Jan-2016,Feb-2016....Etc

Please help me to resolve this issue

sunny_talwar

May be do this in the script:

LOAD Date(MonthStart(Date#(MONTH_YEAR, 'MMM-YYYY')), 'MMM-YY') as MONTH_YEAR

If you only have first three letter of every month, then you need MMM. If you have complete month names, use MMMM.

Once you make the above change, you should be good to use this as your dimension and sort numerically.

vishalgoud
Creator III
Creator III
Author

you are Rocking Sunny,

that's Perfectly working for me .

Cheers ,

Vishal.