Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sofiavaz
Contributor

Sort by expression Issue

Hi  all,

In a pivot table, I wanted to sort InventoryType in this orders:'LATE ORDER','OK ORDER','FUTURE ORDER','CLOSED ORDER','NOT CLIENT','UNIT REJECTED',null()

For that I'm using this expression

Match(InventoryType,'LATE ORDER','OK ORDER','FUTURE ORDER','CLOSED ORDER','NOT CLIENT','UNIT REJECTED',null())

But, as you can see in the image attached, the line for null Inventory Type is the first one and not the last one. I've tried other things like

Match(InventoryType,'LATE ORDER','OK ORDER','FUTURE ORDER','CLOSED ORDER','NOT CLIENT','UNIT REJECTED','')

or

Match(InventoryType,'LATE ORDER','OK ORDER','FUTURE ORDER','CLOSED ORDER','NOT CLIENT','UNIT REJECTED','-')

But anything works…

Does anyone know what i might be doing wrong?

Thank you!

1 Solution

Accepted Solutions
ychaitanya
Contributor III

Re: Sort by expression Issue

Can we try below :

We are forcefully pushing the unmapped category to the end.

if(WildMatch(InventoryType,'*LATE ORDER*','*OK ORDER*','*FUTURE ORDER*','*CLOSED ORDER*','*NOT CLIENT*','*UNIT REJECTED*'),

PICK(WildMatch(InventoryType,'*LATE ORDER*','*OK ORDER*','*FUTURE ORDER*','*CLOSED ORDER*','*NOT CLIENT*','*UNIT REJECTED*'),1,2,3,4,5,6),

7)

7 Replies

Re: Sort by expression Issue

How about this

Match(InventoryType&'-','LATE ORDER-','OK ORDER-','FUTURE ORDER-','CLOSED ORDER-','NOT CLIENT-','UNIT REJECTED-','-')

sofiavaz
Contributor

Re: Sort by expression Issue

Thank you Sunny, but it didn't worked...

ychaitanya
Contributor III

Re: Sort by expression Issue

Can you try this.

WildMatch(InventoryType,'*LATE ORDER*','*OK ORDER*','*FUTURE ORDER*','*CLOSED ORDER*','*NOT CLIENT*','*UNIT REJECTED*')


OR


PICK(WildMatch(InventoryType,'*LATE ORDER*','*OK ORDER*','*FUTURE ORDER*','*CLOSED ORDER*','*NOT CLIENT*','*UNIT REJECTED*'),1,2,3,4,5,6)

sofiavaz
Contributor

Re: Sort by expression Issue

Thank you Chaitanya,

The issue is to sort the empty InventoryType values to the end of the list. With this expressions we are not considering them, are we? I've tried your expressions and the output is the same as with mine.

ychaitanya
Contributor III

Re: Sort by expression Issue

Can we try below :

We are forcefully pushing the unmapped category to the end.

if(WildMatch(InventoryType,'*LATE ORDER*','*OK ORDER*','*FUTURE ORDER*','*CLOSED ORDER*','*NOT CLIENT*','*UNIT REJECTED*'),

PICK(WildMatch(InventoryType,'*LATE ORDER*','*OK ORDER*','*FUTURE ORDER*','*CLOSED ORDER*','*NOT CLIENT*','*UNIT REJECTED*'),1,2,3,4,5,6),

7)

sofiavaz
Contributor

Re: Sort by expression Issue

Thank you Chaitanya! That works!

sofiavaz
Contributor

Re: Sort by expression Issue

I know, but I'm not allowed to do create new fields in the script...

Community Browser