Sum of Column is getting error

Hi Team, I am using linq but value getting round figure when I run

Please find:
dtIDMSDatatableFilter.AsEnumerable.Sum(Function (x) If(Double.TryParse(x.item(“Sum”).ToString, Nothing), Double.Parse(x.Item(“Sum”).ToString),0))

when value of column is 436.57 but when I ran the bot I am getting 436.565
what need to make change in query?

Hi @Sharanabasava

You could use my package ,it will have activity called math operation which gives the option of sum,max,min,average etc.

Hi Prasath,

client don’t need external package, so…
Can you check what’s need to be change?

@Sharanabasava It looks good.

Just add Math.Round function and make it round-up for 2 digits.

Math.Round(varDT1.AsEnumerable.Sum(Function (x) If(Double.TryParse(x.item("u").ToString, Nothing), Double.Parse(x.Item("Sum").ToString),0)),2)

Thanks Pravin, but when I used column with value of 436.57 and run the bot, I am getting 436.56

image

replace Math.Round with below

Math.Ceiling( 436.565 * 100)/100

Thanks Pravin, Its working

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.