Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Rounding Difference

zqlcancer
8 - Asteroid

In my attached sample file you can see I am trying to calculate the tax amount by multiple rate and tax base amount, then use it to minus output tax. I use the round to keep 2 decimals but why I still have the difference for line 2? Is this a bug?

 

RateOutput taxTax base amountTax AmountDifferenceround valueround difference
20(88.32)(441.60)(88.32)0.00(88.32)(0.00)
20(1,094.1000000000)(5,470.52)(1,094.1040000000000)(0.0040000000001)(1,094.1000000000)(0.00000000000023)
2 REPLIES 2
Clifford_Coon
11 - Bolide

Hi,

 

One simple approach it to change your types from double to FixedDecimal   (precision 19 Scale 2) for the columns you are creating in the foumula tool.  

 

When I idd, i get this:

Rate Output tax     Tax base amount Tax Amount Difference round value round difference
20     -88.32            -441.6                 -88.32           0.00         -88.32        -0.00
20     -1094.1           -5470.52            -1094.10     -0.00         -1094.10     -0.00

PhilipMannering
16 - Nebula
16 - Nebula

☝️ What @Clifford_Coon said. Computers aren't good at decimals, they're good at binary. Use a Fixed Decimal (Precision ≈ 19 and Scale = 2) to only show the first two decimal places.

Labels