if similar OPH values then we need do SUM of Zmasak
can you try below
Code:
(From row In DT.AsEnumerable()
Group row By OPH = row.Field(Of String)("OPH") Into Group
Let firstRow = Group.First()
Select DT.Clone().Rows.Add({firstRow("PRFNR"), firstRow("BUDAT"), OPH, Group.Sum(Function(r) Convert.ToInt32(r("ZMASAK")))})
).CopyToDataTable()
Input:
Output:
Cheers!!
Please Enable Preserve format in Read range
(From row In Dt.AsEnumerable()
Group row By OPH = row("OPH").ToString() Into Group
Let sumZmasak = Group.Sum(Function(r) Convert.ToDouble(r("ZMASAK")))
Select Dt.Clone().Rows.Add(Group.First().ItemArray.Take(3).ToArray().Concat({sumZmasak}).ToArray())).CopyToDataTable()
Input:
Output