# Problem with SUM and precision

#1

Hello guys… I’ve came across this issue… I’m working on a table with grouped records, and some currency amounts come from rollups and calculations that have been rounded previously by field type.

The issue is that in grouped view the SUM function is still considering “on the background” the amounts without rounding, thus adding them to the final amount.

See the image:

The correct amount, of course, should be -\$349,950.

Is there any way to change this behaviour? When dealing with rounded currencies, I think this is very important.

Thanks a lot and keep the great work!

Rodrigo.

#2

The best way to change this behavior at this time is to use our Formula system to explicitly round the value.

You can use `ROUND()` in the configuration of the rollup field itself, for example `ROUND(SUM(values))`, which will cause the underlying value in each cell in this field to be rounded, reflecting the exact displayed value. Or you can create an additional formula field that references this field and uses `ROUND()`.

Sorry that this behavior is opaque and we don’t offer easier ways to configure it. We will revisit this at some point in the future, but there are situations where the current behavior is useful that we want to preserve.

#3

Hello Matt, thanks for the reply!

I totally understand your view about this feature, but I think that particularly when dealing with currencies this option should be a bit easier/clearer to work with.

Anyway, thanks again!

#4

You can use ROUND() in the configuration of the rollup field itself, for example ROUND(SUM(values))…

Matt - Is this true of all/most numeric functions — that is, the enclosing function is applied to each individual field value prior to the rollup?

Thanks!

#5

No, the enclosing function `ROUND()` is applied only to the single result of `SUM()`; it is not applied to the multiple individual values.

#6

Ah, got it. That’s how I thought it would work, but I conflated the various SUMs.