how to sum the values in the column which is of type double

how to sum and save that at the edge of the column

Dim sum As Double = dt.AsEnumerable().Sum(Function(row) If(row.Field(Of Double)(“ColumnName”), 0.0))

Assuming you want to store the sum at the end of the column

Dim sumRow As DataRow = dt.NewRow()

sumRow(“ColumnName”) = sum

dt.Rows.Add(sumRow)

You can try like this

`DT1.AsEnumerable().Sum(Function(row) row.Field(Of Double)("Salary")).ToString`

`"A"+(RowsCount+1).ToString`

Hi

→ Read the data table: Use the Read Range activity to read the data table from your source.

→ Calculate the sum: Use an Assign activity to calculate the sum of the values in the double column. You can use the following LINQ expression:

totalSum = dt.AsEnumerable.Where(Function(row) IsNumeric(row(“ColumnName”))).Sum(Function(row) CDbl(row(“ColumnName”)))

where:

→ dt is the data table variable

→ ColumnName is the name of the double column

→ totalSum is the variable to store the sum

→ Add a new row: Use an Add Data Row activity to add a new row at the edge of the data table.

Set the sum value: Use the Set Value at Column Index activity to set the value in the first column of the new row to the calculated sum. The column index will be 0 if you want to add the sum at the beginning of the data table.

Dim totalsum As Integer=0

For Each row As datarow In dt.AsEnumerable

totalsum=totalsum+CInt(row(0))

Next row

dt.Rows.Add(totalsum)

Cheers!!

what is the sum datatype

check this

error

DT1.AsEnumerable().Sum(Function(row) row.Field(Of Double)(“Salary”)).ToString

Change the Sum variable datatype to String

i have changed and iam getting this error