Sorry, I didn't understand what you needed.
Perhaps add a 4th column called "batch".
Enter 1 in D2 and
Code:
=IF(AND(A3=A2,B3=B2),D2,D2+1)
in D3
Apply a PT to these four columns and move the "batch" to the first column in the PT.
That should do the trick