How to calculate the total sum

Hi @nameisname

How about this expression?

(From d in dtData.AsEnumerable Where Not (isNothing(d("Column Name")) OrElse String.IsNullorEmpty(d("Column Name").toString.Trim)) Select v = CDbl(d("Column Name").toString.Trim)).Sum(Function (x) x)

Regards
Gokul

Check out the Sample XAML file

image

SumExcelColumn.xaml (12.6 KB)

Regards
Gokul

Hello @nameisname
Kindly refer to this, you may get some idea
Forum_AddRowValues.zip (77.1 KB)

HI @nameisname

Check this expression if you want TotalSum of a column


DT.AsEnumerable.Sum(Function (x) CDbl(x("Your Column Name").toString.Trim))

If you want to add the three row values and add that in the total column check on this expression


(From row In dt.AsEnumerable
Let a=row("Amount(II)...").ToString
Let b=row("GST").ToString
Let c=row("Shipping Cost").ToString
Let x = CDbl(b)*CInt(c)+CInt(c)+CInt(a)
Select Dt1.Rows.add(x)
).CopyToDataTable

Attaching a sample xaml file and the output file
Main.xaml (10.6 KB)

New Microsoft Excel Worksheet.xlsx (7.9 KB)

Hope This Helps

Regards
Sudharsan