Hello Friends,
I have below 2 queries
- How to do sum of bottom last 4 rows. Output–>1124
- How to get bottom last 3rd date. Output–>-20-Mar
Can anyone help me in this.
Hello Friends,
I have below 2 queries
Can anyone help me in this.
You can try as below
dt.AsEnumerable.Skip(dt.rowcount-4).Sum(function(x) cdbl(x("Sales").ToString))
will give you sum of last 4 rowsdt.AsEnumerable.Skip(dt.rowcount-3).CopyToDataTable
Thse should be using in assign the first output is of type double second output is of type datatable
And i guess 335k is actually 335000 and in the data youw ould get the number only i guess
Cheers
You can use Linq also
DT.AsEnumerable().Reverse().Take(4).Sum(Function(row) Convert.ToDecimal(row(“ColumnName”)))
Hope it will help
Thank you so much for your quick response. Now I am able to solve the issue just because of you guys. @Anil_G, @Pavanraj_Shetty and @Gvivek9889 .
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.