Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Creator III
Creator III

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)

View solution in original post

7 Replies
sunny_talwar

How about this

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

Anonymous
Not applicable
Author

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

ychaitanya
Creator III
Creator III

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)

Anonymous
Not applicable
Author

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
Creator III
Creator III

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)

Anonymous
Not applicable
Author

Thank you Chaitanya! That works!

Anonymous
Not applicable
Author

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