Reporting: Rounding Numeric Values Prior to Calculations

Hello again,

I was adding up some numbers in my report and noticed something was a bit off. It seems that all rounding (in the form of number formats) is done after calculations are performed, leading to discrepancies such as this:

The total amount due here is one cent less than it should be. The key calculations I’m using to calculate these values are:

I know this must be due to the fact that “HST” is actually calculated as 374.4091 rather than 374.41 and FuelTax being calculated as 70.2455 rather than 70.25.

After looking through the reporting manual however, I can only find the function “round(float)” which is described as rounding to the nearest whole number.

Is there a way I can round to two decimal places before doing calculations?

I’d suggest either doing the calculations in a scripting datasource, or else use/abuse multiplying and dividing by 100 so that you can take advantage of the round() keychain function

2 Likes

Multiplying/dividing by 100 and using the round() function worked out well, since I didn’t have to change too much. Thanks! :slight_smile: