Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sort bar chart

Hi!

I have created a bar chart, and I want to sort the bars in a specific order.

I want to sort by "Region" - "Office", like this:

RegionA - Atalanta

RegionA - Colorado

RegionB - Boston

... without showing the Region in the labels.

Is it possible to sort by any expression that includes the region's alphabetical order? Right now I can only sort at the office alphabetical order: Atalanta, Boston, Colorado...

Thanks in advance

Filip

7 Replies
MayilVahanan

HI

Try like this

Sort tab->expression

=SubField(FieldName,'-',2)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

Unfortunately it doesn't work as the SubField function slices the array first, and sorts after that... Still the same result.

Is it possible to do this in another way?

Anonymous
Not applicable
Author

Filip,

Try to eliminate only 'Region' in sort expression:

repalce(FieldName, 'Region', '')

Regards,

Michael

Anonymous
Not applicable
Author

Or, is it that Region and City are two separate fields, and you want to use City as label but sort by Region/City combination?  If yes, try to sort by expression

=Region & City

Reagas,

Michael

Anonymous
Not applicable
Author

Yes, exactly as you writes...

But still, the diagram doesn't load the bars in this order...

Anonymous
Not applicable
Author

Indeed, it doesn't work...

You best bet is to create an additional field Order in the script:

LEFT JOIN (table) LOAD Distinct
     
Region,
     
City,
     
Rowno() as Order
Resident table
ORDER BY Region, City;     

And, use it in sort expression:

=Order

Regards,

Michael

Anonymous
Not applicable
Author

Yeah, I also found a solution with an inline table:

http://www.qlikfix.com/2010/10/25/creating-a-custom-sort-order/

But still, I don't think this is a very good solution. Why do I have to create a field, just to make my dimension sort from any other field...

Thank you very much for your help though! Really appreciated!

Best regards,

Filip