Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
stuwannop
Partner - Creator III
Partner - Creator III

Chart Query - Sorting Dimensions Manually

Hi All

Can anyone help me here - I was wondering if there was a way to sort dimension values in a chart manually as opposed to the default chart options (A-Z, Load Order Etc). So if I had a list of "Regions", North, South, East, West, Scotland, Midlands - how would I present the sales totals (purely for example) in a chart where I could put the regions in any order I please?

Thanks

Stu

1 Solution

Accepted Solutions
Not applicable

Hi Stuart

In the document properties you can set the dimension to sort by using an expression.  For example:-

=IF([NCC.Responsibility Center]='MIDLANDS',1,

IF([NCC.Responsibility Center]='NORTH EAST',2,

IF([NCC.Responsibility Center]='NORTH',3,

IF([NCC.Responsibility Center]='NORTH WEST',4,

IF([NCC.Responsibility Center]='SCOTLAND',5,

IF([NCC.Responsibility Center]='SOUTH',6))))))

I hope this helps.  If you need any further help then please do not hesitate to contact me.

Get In!!

View solution in original post

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

you can sort by expression but this depends on chart type

Not applicable

Hi Stuart

In the document properties you can set the dimension to sort by using an expression.  For example:-

=IF([NCC.Responsibility Center]='MIDLANDS',1,

IF([NCC.Responsibility Center]='NORTH EAST',2,

IF([NCC.Responsibility Center]='NORTH',3,

IF([NCC.Responsibility Center]='NORTH WEST',4,

IF([NCC.Responsibility Center]='SCOTLAND',5,

IF([NCC.Responsibility Center]='SOUTH',6))))))

I hope this helps.  If you need any further help then please do not hesitate to contact me.

Get In!!

giakoum
Partner - Master II
Partner - Master II

you can add an addtional field named order and order by that or you can manipulate the region names to order them as desired :

1. North, 2. South, 3. East, 4. West, 5. Scotland, 6. Midlands

stuwannop
Partner - Creator III
Partner - Creator III
Author

Thanks both - both seem like good things to try

Cheers

giakoum
Partner - Master II
Partner - Master II

having a nested if for sorting is not a good idea. it is memory consuming and affects perfomance. What if a new region is added?

stuwannop
Partner - Creator III
Partner - Creator III
Author

If I created a new field in the script assigning a number to the region would that be better? If I did that how would I then show that in the chart? By chart I mean a simple sum table. I don't want Qlik to display 1. North, 2.Midlands etc as there is other stuff I need to sort.

giakoum
Partner - Master II
Partner - Master II

much better.

you would use that new field in the sort by expression in the chart. if you have multiple rows with the same region, you probably would use min([Order]) and not simply [Order]