@nibir08
thanks for detailed case description.
Assumptions:
Group Values are the same Value and only different on positive or negative
Variables:
Flow:
Preperation result DataTable and grouping the data by firtst Column values
Processing the groups and adding remaining rows to Result Datatable
e.g. getting the posivite values:
(From g In grp
Let x = CInt(g(1).toString.Trim)
Where x > 0
Select r=g).toList
getting the common count:
{PosRows.Count, NegRows.Count }.Min()
Adding remaining rows to result datatable:
(From x In PosRows.Skip(CommonCount).Concat(NegRows.Skip(CommonCount))
Let ra = x.ItemArray
Select dtResult.Rows.Add(ra)).toList
Input / output:
find starter help here:
GroupBy_1Col_OffsetGrpMembers.xaml (11.9 KB)
For getting more familiar with LINQ have a look here: