Iterate through a datatable based on the specific condition of column

have a check on this pattern, maybe it works directly or need some minimal adoptions:

taken from [HowTo] Overview on different options for grouping data and processing the groups