7 Replies Latest reply: Nov 15, 2015 6:19 AM by Marcel Hug RSS

    how to rank item within groups

    Alex Wang

      Hi,

       

      I am trying to rank item within a group, see below example, add a new column Rank to count the order of Cat_2 which in the same group of Cat_1. Then I can just select rank=1, to get a 1 to1 mapping table between Cat_1 and Cat_2

       

      Can I fulfil this in a loading script?

       

      Thanks a lot!

       

      INPUT
      Cat_1Cat_2
      1a
      1d
      1b
      2f
      2j
      2k
      3n
      3m
      3l
      3s
      ......
      EXPECTED OUTPUT
      Cat_1Cat_2Rank
      1a1
      1b2
      1d3
      2f1
      2j2
      2k3
      3l1
      3m2
      3n3
      3s4
      .........