Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
tduarte
Partner - Creator II
Partner - Creator II

Problem with sort order

Hi,

I'm trying to sort a table where regardless of the total, when Category is 'Other' then it should be at bottom of the table. The other values should be sorted by total.

Sort-> Sum(Units):

CategoryUnitsSort
Notebooks400400
Tablets300300
Other200200
Desktops100100

Sort-> Sum(Units)*if(Category='Other',-1,1) :

CategoryUnitsSort
Notebooks400400
Tablets300300
Desktops100100
Other200-200

So far so good. Now, the problem is that is some cases the total values are negative which put Other at the top (-200*-1=200) and not bottom.

CategoryUnitsSort
Other-200200
Desktops-100-100
Tablets-300-300
Notebooks-400-400

What would be a possible sort expression that suits both scenarios?

11 Replies
mphekin12
Specialist
Specialist

Please take a look at the sample I have attached.  I am not using the flag in the calculation at all.  I'm only using it as a dimension for sorting.

tduarte
Partner - Creator II
Partner - Creator II
Author

Thanks mphekin12,

That works but not applicable in my situation because my object is pivot table, meaning I cannot hide the dimension.