A Note about List Sum Decimal Places

  • 6 June 2018
  • 1 reply
  • 4 views

Hi All,

 

 

 

 

I came across an issue with a customer recently where it appeared that the sum of a column of decimals in a list view was rounding up incorrectly (i.e. should be 200.41 but was returning 200.42). After some investigation we found that although he had set the values being summed in the column to show only two decimal places, the sum was actually adding up the real numerical values (all decimal places), and not the displayed ones, resulting in this hundredths place discrepancy. Here's an example to demonstrate this a little more clearly:

 

 

 

 

 

Say we have a number, 1.95, but we are displaying only one decimal place. Thus, the column and sum will look like this:

 

 

1.9

 

 

1.9

 

 

3.9

 

 

 

 

 

Note that if the sum feature was adding 1.9 + 1.9, our expected value would be 3.8. However, since the sum function takes the ACTUAL values 1.95 and 1.95 and not the displayed ones, our returned value is 3.9.

 

 

 

 

 

To make sure the summed value returned is reflective of the values being added, set the column of values to display all decimal places. That way, when the sum is returned you can round yourself rather than  deal with what looks like an inaccurate sum.

 

 

 

 

 

Hope this explanation made sense and saves you guys some headaches in the future.

 

 

 

 

 

-Emily

 

 

 

 


1 reply

Badge +8

Thank you Emily

Reply