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: 
miranrai
Contributor III
Contributor III

Custom sorting in Qlikview straight table

Hi,

I have a straight table which is showing top n products by their sales. I have to sort these products by top n desc and it should show top n values + others by date except product = car. Car should always appear at the bottom after others even if its not part of top n. Please help. Attached is the sample QV app.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

Calculated dimension:

=Aggr(If(Rank(Sum({<Product-={'Car'}>}Sales))<=vTopN, Product, if(Product='Car', Product, 'Others')), Product)

Sort Desc by  expression:

=Aggr(If(Rank(Sum({<Product-={'Car'}>}Sales))<=vTopN, Sum(Sales), if(Product='Car', -2, -1)), Product)

Capture.JPG

View solution in original post

2 Replies
tresesco
MVP
MVP

Try like:

Calculated dimension:

=Aggr(If(Rank(Sum({<Product-={'Car'}>}Sales))<=vTopN, Product, if(Product='Car', Product, 'Others')), Product)

Sort Desc by  expression:

=Aggr(If(Rank(Sum({<Product-={'Car'}>}Sales))<=vTopN, Sum(Sales), if(Product='Car', -2, -1)), Product)

Capture.JPG

miranrai
Contributor III
Contributor III
Author

Perfect! Thank you Tresesco