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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting in unique manner

Hi Team,

I have a below unique sort requirement wherein the client has requested the below logic to be applied.

The tables should show the sales in descending order but should keep the Product - 'OTHERS' as the last product even if the Sales may be max.

ProductSales
X200
B130
H100
D98
OTHERS240

Please advise how to resolve this. In Sort tab, under expression, tried the below expression

if( [Product] <> 'OTHERS',rank([Sales]). Below is the result but Product 'Others' remains at the top instead of at the bottom.

ProductSales
OTHERS240
X200
B130
H100
D98
1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Using this in your expression for Sort by should work well:

If( Product = 'OTHER' , 0 , -Sum(Sales) )


2017-02-25 QC-001.PNG

View solution in original post

8 Replies
Chanty4u
MVP
MVP

try below

=if(Match(PRODUCT,'OTHERS','X','B','H','D'),Sales)

Not applicable
Author

Hi,

The Sales will change every week and as per the Sales value the table should be sorted in descending order and 'Others' must remain the last row ignoring the above ranking. I have Regions in another listbox, on selection, the Products will either go above or below as per the sales value hence cannot explicitly define the Product names in Match function.  The above solution does not give my required result.

Not applicable
Author

Could someone please help with a solution to the sorting order issue.

Thanks

Shinu

ecolomer
Master II
Master II

If OTHERS is the result of the accumulation of the remaining unrelated values, the solution can be ordered by Y value but by setting a limit of 5 values and the rest in a total that is called OTHERS

shivkumar300
Contributor III
Contributor III

Hi,

try this

if([Product] <> 'OTHERS','1',if([Product] ='OTHERS',rank([Sales])))

antoniotiman
Master III
Master III

Hi Shinu,

in Sort Expression try

If(Product <> 'OTHERS',Sum(Sales),0)  

Regards,

Antonio

petter
Partner - Champion III
Partner - Champion III

Using this in your expression for Sort by should work well:

If( Product = 'OTHER' , 0 , -Sum(Sales) )


2017-02-25 QC-001.PNG

Not applicable
Author

Thank you so much. You are a genius.