How to re-iterate numbers in a column based on values in other column? Please Help

Please help me to solve this.

In a datatable, I need to reiterate numbers based on the values available in another column.
(the data in columnA is sorted)

What I have:
ColumnA ColumnB
A_1_X
A_1_X
A_1_X
A_1_Y
A_1_Y
A_2_X
A_2_X
A_2_Y
B_1_X
B_1_X
B_1_Y

What I need:
ColumnA ColumnB
A_1_X 1
A_1_X 2
A_1_X 3
A_1_Y 1
A_1_Y 2
A_2_X 1
A_2_X 2
A_2_Y 1
B_1_X 1
B_1_X 2
B_1_Y 1

Since dealing with datatable with large data, I am trying in LinQ Query instead of For Each loop:

Please help me

@GuhanTM
Find Starter Help here:
GuhanTM_GroupBy.xaml (7.0 KB)

1 Like

Thank you very much @ppr
Its working good and the result is exactly as expected.
Thanks again :+1:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.