# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for
Did you mean:
Contributor III

## Sort measure in pivot table with multiple dimensions

Hi experts,

I haven't been able to find the perfect solution to my problem in the different forums.

Ive got the following table:

Hotels:

country, city, chain, name, sales
España, Barcelona, NH, hotel1, 9000
España, Bilbao, Melia, hotel4, 7500
Italia, Turin, Ibis, hotel5, 20000
Italia, Milan, NH, hotel6, 3500
Italia, Roma, Ibis, hotel7, 19000
];

I need my the measure Sum(sales) to be sorted by different dimensions:

ie: first by country, then by chain.

I have found the follwoing formulas in forums:

Sort dimension 1

Aggr(sum(sales), [country] )

Sort dimension2

Aggr(sum(sales), [chain] )

The main problem here, as you can see in the picture, is that the the chains of each country are sorted by the total amount of the chain, indpendently from the measure country.

Don't hesitate to ask for questions in case I havent explained myself properly.

Labels (2)

• ### sorting

2 Replies
Support

hello,

What is the expected result you want to display, I will see if I can produce the desired output from the given data.

Regards,

akki

Contributor III
Author

That was quite a simple example. I've got 4 dropwdown lists where the user can select different fields.

If the user selects 'country', the values in the field should be sorted by sales and country;

if the user selects country and city, the values should be sorted first by country, and then within the country, sorted by city;

country,city ,chain ,name , sales
Italia ,Turin ,Ibis ,hotel5, 20000
Italia ,Roma ,Ibis ,hotel7, 19000
Italia ,Milan ,NH ,hotel6, 3500