2 Replies Latest reply on Jan 11, 2017 2:12 PM by Tyler May

# Calculation Rounding Error

I'm starting a separate topic that stemmed from a suggestion Shinichiro offered on a previous question I had regarding calculating the sale differences from the week prior.

Now I would like to know if it is normal for calculations in Tableau to have significant rounding errors.  The percent difference formula is \

(Sales - Last Week Sales) / Last Week Sales)

A positive value means the value increased from last week, negative means it decreased.  Below is a screenshot of snippet of the view, followed by the expected values calculated in Excel.

The percentages in red are values off by more than +/- 1%

The difference is more apparent when comparing smaller values.  Without even using a calculator, I could easily tell the percentages were not correct.  The differences are roughly +/- 6 to 18%

I'm using version 10.1.1

• ###### 1. Re: Calculation Rounding Error

Take below item as an example,

Actual number should be 23.55 and 5.114 ==>  23.55/5.114 = 4.60500 (up 360.5%)

Display number though is 24 and 5 which resulted in 24/5 = 4.8 (up 380%)

If you need 380% up as correct number, you need to round it not only display but also calculated field itself.

Thanks,

Shin

1 of 1 people found this helpful
• ###### 2. Re: Calculation Rounding Error

To jump onto what Shin wrote above, you could use the Round function in your calculation.  Changing your calculation to be something like this:

(ROUND(Sales,1)-ROUND(Last Week Sales,1))/ROUND(Last Week Sales,1)

If you want to do anything fancy with rounding (Ceiling or floor rounding), here is a great post from James Dunkerley: Rounding Calculations in Tableau (and Excel and Alteryx) | James Dunkerley's Blog