1 Reply Latest reply: Oct 14, 2018 3:23 PM by Daniel Berkes RSS

    Sort by expression

    Wanyun Yang

      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!

        • Re: Sort by expression
          Daniel Berkes

          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