Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date Order "Month"

Hi,

Kindly advice how to sort Months in Charts to be in correct order  (Jan, Feb, Mar, Apr......).

Now it is showing as ( Apr, Aug, Dec, Feb, Jan, Jul, Mar, May.....)!  I have tried all options in the Sort tab but did not help.

Thank You.


1 Solution

Accepted Solutions
ecolomer
Master II
Master II

You can transform in your script:

Aux:

LOAD

  dual(string, numrep) as Cal_Mes INLINE [

  string,numrep

  jan, 1

  feb, 2

  mar, 3

  apr, 4

  mai, 5

  jun, 6

  jul, 7

  ago, 8

  sep, 9

  oct,10

  nov,11

  dec,12

];

to have a dual field and use Iwrote last

View solution in original post

9 Replies
ecolomer
Master II
Master II

sort by Num(Month) because is a dual variable

Anonymous
Not applicable
Author


Not so clear Enrique !

Please explain further.

ecolomer
Master II
Master II

OK, I'm sorry

If you have a field "Month" with date format, this field are dual: numeric (1, 2, 3 ...) and text (Jan, Feb, ...)

If you need use them in numeric format, write Num(Month) to use numeric values

In the order you can write in Expression: Num(Month)

ecolomer
Master II
Master II

to have a correct management, the Month field must have date format

Agis-Kalogiannis
Employee
Employee

Hi

The only thing you need to do when you use Month as chart dimension, is to sort this dimension by Numeric Value, Ascending (on the Sort Tab), and this will sort the months the way you want.

This is because although we can see a three-character format of the month, for QlikView, months are still integers (1-12), so if you want to sort of even align these values, you'll have to treat them as numbers.

I hope this helps

Agis

jonathandienst
Partner - Champion III
Partner - Champion III

Faisalaaa wrote:

I have tried all options in the Sort tab but did not help.

I suspect that your month field is a text field, not a dual Month() field. Use something like this to convert the text Month field from your data source into a dual Month field:

     LOAD ....

          Month(Date#(Month, 'MMM')) As Month

Then sort numerically.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Thanks Enrique /Agis,

But I havetried both ways, did not work.

My Dimension is  Month as Jan, Feb, Mar.  Not as dd/mm/yy.

In the sort tab, I have tried Numertic value sort  AND Expression as Text(Month) and Num(Month), giving me an error !

awhitfield
Partner - Champion
Partner - Champion

Hi Faisalaaa,

are you able to post a sample qvw for further investigation?

Andy

ecolomer
Master II
Master II

You can transform in your script:

Aux:

LOAD

  dual(string, numrep) as Cal_Mes INLINE [

  string,numrep

  jan, 1

  feb, 2

  mar, 3

  apr, 4

  mai, 5

  jun, 6

  jul, 7

  ago, 8

  sep, 9

  oct,10

  nov,11

  dec,12

];

to have a dual field and use Iwrote last