Add a calculated column to count duplicate values by date


I am trying to add a calculated column to count duplicated values by date in my data table.

I first sort my data by column serial_number asc and then by column shipping_date asc. Then I want to add a column to count same serial_numbers by shipping_date.

For example, I have three rows with same serial_number AAAAA, and they have different shipping_date with 2011_04, 2013_05, and 2016_07. I want to mark these three rows with '1' for 2011_04, '2' for 2013_05, and '3' for 2016_07. And for any other rows with same serial_number, I want to mark them with same rule. At the end I would have a calculated column marked with 1,2,3.... for each serial_number by shipping_date.

What should I write in the Expression box of Add a calculated column? Thanks!

No. Serial_Number Shipping_Date Calculated Column
1 AAAAA 2011_04 1
2 AAAAA 2013_05 2
3 AAAAA 2016_07 3
4 BBBBB 2016_04 1
5 CCCCC 2013_02 1
6 CCCCC 2014_07 2


(3) Answers