5 Replies Latest reply: Mar 3, 2016 3:44 AM by Raphael Blavier

# How to refer to the dimension in sort expression ?

Hello,

I have created a bar chart with a calculated dimension.

I want to manually sort that dimension with the expression :

I add this formulae to the expression :

=if(Salaire='[-20K€[',1,
if(Salaire='[20K€;30K€[',2,
if(Salaire='[30K€;40K€[',3,
if(Salaire='[40K€;50K€[',4,
if(Salaire='[50K€;60K€[',5,
if(Salaire='[60K€;70K€[',6,
if(Salaire='[70K€;80K€[',7,
if(Salaire='[80K€;90K€[',8,
if(Salaire='[90K€;100K€[',9,
if(Salaire='[100K€;120K€[',10,
if(Salaire='[120K€;140K€[',11,
if(Salaire='[140K€;180K€[',12,
if(Salaire='[180K€;240K€[',13,14)))))))))))))

However it does not recognize the "Salaire" field, witch is my dimension, is there a system variable to refer to the dimension ?

Many thanks ?

• ###### Re: How to refer to the dimension in sort expression ?

Can you try removing the word Salarie and start retyping it? Usually QlikView will tell you what the field name is and you can just press enter. This way QlikView will add the name of the field itself and you will be able to see if there are some extra space or something else that was causing the issue for you.

or you can also try adding square brackets around Salarie -> [Salarie] and that might work as well.

• ###### Re: How to refer to the dimension in sort expression ?

I tried to retype "Salaire" however the autocompletion did not found it.

"[Salaire]" is also not working. I tried that already.

Thanks for the ideas anyway ;-)

• ###### Re: How to refer to the dimension in sort expression ?

Have you tried sort by 'Y-Value'? If that is not what you want, try to share a representative qvw.

• ###### Re: How to refer to the dimension in sort expression ?

Unfortunately sorting value by "Y-Value" does not work because I created a calculated dimension to regroup salaries into intervals.

I want to sort from the smaller interval in terms of salaries ("[-20K€[" ; "[20K€;30K€[" -> "[180K€;240K€[" ; "[+240K€[").
If I sort it by "Y-Value", the "[20K€;30K€[" will come first because most of employees have this salary.

I'll try to share something soon, but I can't share directly my Qlikview, it contains sensitive information.

• ###### Re: How to refer to the dimension in sort expression ?

Your "Salaire" dimension is text and you need to sort it by number. This is similar to sorting months.

One solution is to load the data using the DUAL() function. See help or calendar generators scripts.

Another solution is to add a column in your data that will hold the sorting value. Move your if() expression in the script to calculate a "SalarieSort" column and just write '=SalarieSort' in the sort expression.