Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community!
I am currently stuck with an issue that does not suppose to be so difficult.
I want to sort dimensions in a bar chart by an expression and did several trials. You can see my bar chart in the image I uploaded. There I want the Hotel dimension to be sorted like this:
Match(Hotel,'B Hotel', 'Barcelona Universal', 'Hotel 1898', 'Hotel Europark', 'Hotel Gran Vía', 'Hotel Jazz', 'Hotel Paral.lel', 'Hotel REC Barcelona', 'Hotel SOHO Barcelona', 'Hotel The Corner', 'Midtown Apartments', 'U232 Hotel')
I set this formula in the custom expression field and did not work. It only sorted the legend.
My second trial was, following this video Changing the sorting of a visualization using expressions - Qlik Sense, doing a much more elaborated formula:
If(Hotel = 'B Hotel',1,
If(Hotel = 'Barcelona Universal', 2,
If(Hotel = 'Hotel 1898', 3,
If(Hotel = 'Hotel Europark', 4,
If(Hotel = 'Hotel Gran Vía', 5,
If(Hotel = 'Hotel Jazz', 6,
If(Hotel = 'Hotel Paral.lel', 7,
If(Hotel = 'Hotel REC Barcelona', 8,
If(Hotel = 'Hotel SOHO Barcelona', 9,
If(Hotel = 'Hotel The Corner', 10,
If(Hotel = 'Midtown Apartments', 11,
If(Hotel = 'U232 Hotel', 12))))))))))))
It did´nt work either. My next step was to try an Inline table to do the job:
OrdenHoteles:
Load * Inline [
Hotel, OrdenHotel
B Hotel, 1
Barcelona Universal, 2
Hotel 1898, 3
Hotel Europark, 4
Hotel Gran Vía, 5
Hotel Jazz, 6
Hotel Paral.lel, 7
Hotel REC Barcelona, 8
Hotel SOHO Barcelona, 9
Hotel The Corner, 10
Midtown Apartments, 11
U232 Hotel, 12
];
Then I set the dimension OrdenHotel in the custom expression field, but Qlik Sense seemed to ignore it.
Finally I mapped the field Order to the Hotel tables and try to use it with the same result:
OrdenHoteles:
Mapping
Load * Inline [
Hotel, OrdenHotel
B Hotel, 1
Barcelona Universal, 2
Hotel 1898, 3
Hotel Europark, 4
Hotel Gran Vía, 5
Hotel Jazz, 6
Hotel Paral.lel, 7
Hotel REC Barcelona, 8
Hotel SOHO Barcelona, 9
Hotel The Corner, 10
Midtown Apartments, 11
U232 Hotel, 12
];
IristraceCheckList:
Load
*,
ApplyMap('OrdenHoteles',Hotel) as Orden
Resident tmpIristraceCheckList;
Certainly I am not an expert in Qlik Sense, so it´s very likely that I omitted something.
Any help would be greatly grateful!
Kind Regards!
Use this expression
Match(Only({1} Hotel),
'B Hotel',
'Barcelona Universal',
'Hotel 1898',
'Hotel Europark',
'Hotel Gran Vía',
'Hotel Jazz',
'Hotel Paral.lel',
'Hotel REC Barcelona',
'Hotel SOHO Barcelona',
'Hotel The Corner',
'Midtown Apartments',
'U232 Hotel')
And move the sorting for Hotel above NumberOfChecklists under Sorting
I am not seeing any image, did you forget to attach one? Also, it might be easy if you are able to share a sample qvf to see the issue
Hi Sunny:
Please find attached a very basic qvf file where I am still not able to customize the sort order 😞
Thanks in advance!
Use this expression
Match(Only({1} Hotel),
'B Hotel',
'Barcelona Universal',
'Hotel 1898',
'Hotel Europark',
'Hotel Gran Vía',
'Hotel Jazz',
'Hotel Paral.lel',
'Hotel REC Barcelona',
'Hotel SOHO Barcelona',
'Hotel The Corner',
'Midtown Apartments',
'U232 Hotel')
And move the sorting for Hotel above NumberOfChecklists under Sorting