Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

Sort by expression

My pivot table column is customer. Each customer has two status fields: field IMPORTANT:0,1 shows if they are important or not. field CUSTOMERSTATUS: new, old shows if the are new or old customers. I want to sort customer by: IMPORTANT=1, everything else, CUSTOMERSTATUS=new. How should I write the sort by expression expression without changing model?

Thank you in advance!

1 Reply
dberkesacn
Partner - Creator III
Partner - Creator III

Hi,



Sort by exp:

if(IMPORTANT=1,1,

if(CUSTOMERSTATUS = 'NEW',2

    ,3)

        )


Test Data:

Load * Inline [

CUSTOMER,IMPORTANT,CUSTOMERSTATUS

C001,0,NEW

C002,1,OLD

C003,0,NEW

C004,1,OLD

C005,1,NEW

C006,0,OLD

C007,1,NEW

C008,1,OLD

C009,0,NEW

];


Preview

sort.jpg