Using variables in a calculation

I have a report with subtotals (formatted to currency with 2 decimals) in footer lines that are being set as variables.
Eventually in a grand total line all of those variables are being added together.
The thing is the resulting number is wrong, it is a different number than the number the calculator gives for the same set of numbers (several cents off). When using the variables I have to use the toNumber() function otherwise an error is thrown. I wonder if the toNumber() function is throwing off the decimals at all or is the system not liking adding up all of the variables?

I read another post that mentioned ‘AddVarsToFields’. I dont know what this is but would that help me at all, if so where is that located?

Thanks

Could you post a screenshot both of the formula and the result you’re seeing? That would help with a diagnosis. If you can reproduce the issue with a sample report, feel free to upload it here.

This ended up being a case of rounding and decimal precision. By changing all applicable data, footer and group footer lines to 4 decimal places the issue is resolved.

1 Like

Thanks @William_Whitley for sharing the solution.

1 Like

© combit GmbH