How to sum up the duplicates values

Hi @T_Y_Raju ,

First you will have to filter the data based on the fff column to consider only rows containing PA2 and then you can use the following code to get the sum of the duplicate columns. add this in the assign statement and add your datatable instead of dt
(From row In dt.AsEnumerable
Group row By key = New With { Key.group = row.Item(“aaa”).ToString.Trim
} Into grp = Group
Select dt.LoadDataRow(New Object() {
Key.group,
grp.Select(Function(x) x(“bbb”).ToString).First,
grp.Select(Function(x) x(“ccc”).ToString).First,
grp.Select(Function(x) x(“ddd”).ToString).First,
grp.Sum(Function (r) Convert.ToDouble(r.Item(“Amount”).ToString)),
grp.Select(Function(x) x(“fff”).ToString).First
}, True)).CopyToDataTable
after this you can merge the datatable containing PA4.

4 Likes