2 Replies Latest reply on Feb 8, 2016 4:09 PM by Daniel Katz

# Why are my percentages not calculating correctly?

I am trying to create a calculated field as percentage based upon two measures.  When I do so the number comes out to greater than 100% which is not possible from my figures.  So, to check what is going on I divide one measure by itself.  In this case the math should equal 1 (100%).

The formula is:

IIF([Total] !=0, [Total]/[Total],0)

Yet the total ends up being 124419.1% and then I create another similar calculated field with the same formula and get and 136100.00%

If I simply use [Total]/[Total] I do get the same results.

Any idea for why this simple division operation is not working.

• ###### 1. Re: Why are my percentages not calculating correctly?

If Total is a row level calculation e.g. reference to a column in your data and you're using the calculated field as an aggregate e.g. SUM(IIF([Total] !=0, [Total]/[Total],0)) what it will do is to first compute total/total which is 1. then sum up those 1s hence giving your more than 100%.

If you aggregate upfront e.g.

SUM(IIF(SUM([Total]) !=0, SUM([Total])/SUM([Total]),0))

then you should get 100% as expected.

• ###### 2. Re: Why are my percentages not calculating correctly?

This worked.  Thank you

From: Bora Beran

Sent: Monday, February 08, 2016 6:26 PM

To: Daniel Katz <dkatz@repequity.com>

Subject: Re:  - Why are my percentages not calculating correctly?

Tableau Support Community

Why are my percentages not calculating correctly?

reply from Bora Beran

in Forums - View the full discussion