Hi, can someone help me. I need to calculate the sum of 3 column.
From top table, to become the lower table
Really appreciate if someone can give me the solution
Hi, can someone help me. I need to calculate the sum of 3 column.
From top table, to become the lower table
Really appreciate if someone can give me the solution
Hi @Hakim_Asyraf,
It seems that you want to sum all the rows with same value in column A, is that correct?
@Hakim_Asyraf
find starter help here:
GroupBy_Sum_2Col.xaml (8.6 KB)
in your case it could look like this
(From d In dtData.AsEnumerable
Group d By k=d("PO Number").toString.trim Into grp=Group
Let cs1 = grp.Sum(Function (x) Convert.ToDouble(x("PO Line Qty").toString.Trim))
Let cs2 = grp.Sum(Function (x) Convert.ToDouble(x("PO Line Qty Received").toString.Trim))
Let cs3 = grp.Sum(Function (x) Convert.ToDouble(x("PO Line Qty Invoiced").toString.Trim))
Let ra = New Object(){k,grp.First()("Invoice #"),cs1,cs2,cs3}
Select dtResult.Rows.Add(ra)).CopyToDataTable
k=d(“PO Number”) is doing the grouping by the column PO Number. It can bechanged to another column or also extend to doing the grouping by taking additional columns into account
Actually I want to sum with the value from column B
thank you so much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.