Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression in sort order disturbed when filtering on dimension and using set analysis.

Hi,

I have a QlikView app where I want to visualize Sales by Markets. But some markets are prioritized and have to be sorted by a special order. So I have created a SortOrder on the Markets and in my charts I use expression sort and set it to =SortOrder. And at first glance it looks nice. But if I start to click around and filter in my app, my expression sort does not work as expected.

Please see my attached example app. In the main figure I _always_ want to see sales for the markets C, B and A. In that order. But if I filter on Prioritized = N in the list box, I see markets A, B, C.

If I click on Prioritized = Y, the top figure is correct, on the bottom left bar chart, my prioritized markets is put at the end.

The bottom right bar chart always seem to have the correct sorting, but have a simple expression Sum(Sales).

The two charts that get wrong sorting, have expressions =Sum({$<Market, Prioritized={'Y'}>} Sales) and =Sum({1}Sales). So to me this seem to be an issue when using set analysis combined with expression sort.

Any ideas on how to implement this functionality. The figure with only prioritized markets (Sum({$<Market, Prioritized={'Y'}>} Sales) are the most important. Any help appreciated!

Regards,

Tom Arne Sivertsen

3 Replies
Gysbert_Wassenaar

What happens afaict is that when you select Prioritized = N there are no possible sortorder values for the chart with prioritized sales. So the chart falls back on the load order. To fix this you can create the sort order in the script by loading the Markets in the order you want. You can do this with an inline table

SortedMarkets:

Load * inline [

Market

D

E

F

G

C

B

A

];


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks for your reply! To create "sort" tables, but it made our data model more complex than we wanted.

But we got the idea to apply sort order as Only({1}SortOrder), which also seemed to give our preferred sorting. Any possible pitfalls in this?

Regard,

Tom Arne

Gysbert_Wassenaar

You can join the sort tables to the 'real' tables so only the 'real' tables remain. You just have to create the sort tables first to establish the sort order of the field the way you want it.

Only({1}SortOrder) should work fine afaik. If you have a very complex chart and/or a very large dataset you might see some performance degradation. Probably nothing to worry about now.


talk is cheap, supply exceeds demand