Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting in chart

Hi friends,

I have a quarter field with the values

110,209,210,309,409 its a number filed

so when i used this field in chart its not in order.

i wanted to display this as

209,309,409,110,210

how can i do this any help???

Regards,

mahesh.g

7 Replies
Or
MVP
MVP

There's a number of ways to do this (for example, using Dual()), but the quick-and-dirty solution would be to sort by an expression, and use:

left(quarter,2) & right(quarter,1)


(In other words - for the purpose of sorting, reverse the order of year and quarter).

Hope this helps.

kji
Employee
Employee

If the data is read chronologically you could just use "Load Order" as sort.

Not applicable
Author

i have written expression in sorting like mid(qtr,2,1).

and sorted by numeric value . its giving the correct sorting values but i think this is not that way to get .

i need to get proper solution for this .

is there any one to give???

Not applicable
Author

hi,

any help how can i sort my quarter???

johnw
Champion III
Champion III

I sometimes sort my data while loading and use load order, as Johan said. I'm not sure if it goes all the way to a "proper solution", but it works well enough.

I think dual() as mentioned by Or Shoham would be a "proper solution". Each quarter then has a display value and an underlying numeric value, and the underlying numeric value can be used to sort the quarters correctly. For instance, something like this:

dual(ceil(month(Date)/3)&yearstart(Date,'YY'),quarterstart(Date)) as Quarter

There's also this approach, which I think is much more understandable than using something like 310 as your quarter:

quartername(Date) as Quarter

Not applicable
Author

hi all,

i am keep on trying with all the things but no luck .

i have created ag roup with quarter and year. i am using this group field in chart thats the big problem to get sorting in chart.

year is sorted but i am not able to sort quarter.

can any have any idea on this???

regards,

mahesh.aga

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

did you try to enter a new field in your script

Num(QuarterName(Datefield)) as NumQuarter

this gives you a number of the Datefiled for every quarterbeginning.