Recommand · October 14, 2021 0

Row numbering based on contiguous data?

I need to assign numbers to rows based on a date. The rule is that the same number is assigned to multiple contiguous rows with the same date. When a row’s date value differs from the previous row’s date value, the number is incremented. The result set would look something like this:

7/1/2021     1
7/2/2021     2
7/2/2021     2
7/1/2021     3
7/2/2021     4

The value of the date is not what’ relevant in this case. As you can see, there are repeats of the same date that get assigned different numeric values because they are not contiguous. I’m struggling to figure out how I would accomplish this.