I have 2 datatable with same no. And name of columns, I want to add the values of one dt column to another dt same column and show the overall sum using both dt w.r.t to there columns
you can use merge datatable activity to merge two datatables
and use the below linq query to get the sum
table.AsEnumerable().Sum(x=>x.Field(“column name”))
Hi @amisha_verma ,
If you want to add two common columns from different data tables you can either loop & do the summation or you can use the below Linq query which will compare two columns & do the sum if similar into a new data table .
(From table1 In dt1
Join table2 In dt2 On
table1(“ColumnName”).ToString Equals table2(“ColumnName”).ToString
Select newDT.Rows.Add({table1(“ColumnName”), CInt(table1(“ColumnName”).ToString.Trim)+CInt(table2(“ColumnName”).ToString.Trim)})).CopyToDataTable