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

Custom Sorting of rows in a Table

Hi all,

Thanks in advance for your support.

I am having a table with 2 columns, I want show this table 

Item Sale
Alice Mutton 17605
Boston Crab Meat 9815
Camembert Pierrot 20505
Carnarvon Tigers 15950
Escargots de Bourgogne -2076
Inlagd Sill -6894
Jack's New England Clam Chowder 4957
Konbu 813
Tunnbröd -2289
Uncle Bob's Organic Dried Pears 9186
Zaanse koeken -2931

 

I want to show the above table with some custom sorting. like First 3 rows are always fixed and last row is fixed remaining 7 rows need to come in descending order of sales(Dynamically - Sales data changes every Monday).

Item Sale  
Alice Mutton 17605 First 3 items are fixed
Camembert Pierrot 20505
Tunnbröd -2289
Carnarvon Tigers 15950 These 7 values, sorting order is decending order
Boston Crab Meat 9815
Jack's New England Clam Chowder 4957
Konbu 813
Escargots de Bourgogne -2076
Zaanse koeken -2931
Inlagd Sill -6894
Uncle Bob's Organic Dried Pears 9186 Last row is fixed
Labels (1)
3 Replies
Clement15
Partner - Specialist
Partner - Specialist

Hello,

Can this meet your need?

 

 

Data:

LOAD

*




INLINE [

Item, Sale

Alice Mutton ,17605

Boston Crab Meat, 9815

Camembert Pierrot, 20505

Carnarvon Tigers, 15950

Escargots de Bourgogne, -2076

Inlagd Sill, -6894

Jack's New England Clam Chowder ,4957

Konbu ,813

Tunnbröd, -2289

Uncle Bob's Organic Dried Pears, 9186

Zaanse koeken ,-2931

];




NoConcatenate




Final:

load

*,

if(Item='Alice Mutton',1, 

if(Item='Boston Crab Meat',2, 

    if(Item='Camembert Pierrot',3,

        if(Item='Zaanse koeken',1000,

            AutoNumber(Sale)+3)))) as Sorting

Resident Data

order by Sale desc;




drop table Data;

 

Clement15_0-1737619614713.png

 

Chanty4u
MVP
MVP

Try this 

LOAD * INLINE [

Item, Sale, SortOrder

Alice Mutton, 17605, 1

Camembert Pierrot, 20505, 2

Tunnbröd, -2289, 3

Carnarvon Tigers, 15950, 4

Boston Crab Meat, 9815, 5

Jack's New England Clam Chowder, 4957, 6

Konbu, 813, 7

Escargots de Bourgogne, -2076, 8

Zaanse koeken, -2931, 9

Inlagd Sill, -6894, 10

Uncle Bob's Organic Dried Pears,

9186, 11

 

And use sort order in ur table or chat

];

MMK
Contributor III
Contributor III
Author

Hi Chanty4u,

Thanks for your reply. 

Sales data changes weekly, what ever solution you provided is static one.