3 Replies Latest reply on Mar 31, 2016 12:13 PM by Dhanashree Arole

# Calculated Field Format Issue

Hi Community,

I have created ratio which is merely division of two measures. It works perfectly fine in one workbook

The values in third column are computed as [Metric Canspam WDW] / [Metric Delivered] and displayed as Percentage with 3 float values.

Now, I have another workbook that is identical, although deals with bigger numbers:

As you can see, the Canspam Ratio WDW is totally incorrect!? Why?

Is this related to data type of measures involved? Can that be adjusted somewhere in settings etc?

What I expect to see is for code 9759, canspam ratio WDW should equal to 0.011599%

What am I missing?

Thanks for your feedback!

Dhanashree

• ###### 1. Re: Calculated Field Format Issue

are you able to attach a packaged workbook?  It would be easier to troubleshoot this way.

• ###### 2. Re: Calculated Field Format Issue

Howdy,

This is mostly likely going to be an issue with aggregations. Lets use this excel table for example:

 Value1 Value2 % Ratio 10 12 83% 5 10 50% 20 100 20% 10 50 20% 173%

This is how you are querying Tableau. You're saying divide Value 2 by Value 1 and then sum it all up. Its easier to think about in excel because you see everything in front of you whereas Tableau this occurs behind the scenes.  So just as in algebra and old maths we have to concern ourselves with the order of operations. You would SUM of all Value 1 and SUM all of Value 2 first.

So this query 'properly written' in tableau is SUM([Value1]) / SUM([Value2]) And you'd get the proper ratio of 45 / 172 or 26%

Cheers!

Carl Slifer

InterWorks

2 of 2 people found this helpful
• ###### 3. Re: Calculated Field Format Issue

That was it Carl!

Appreciate this vivid explanation, never thought about it that way ☺ You can have all the points for answering so prompt and to the point.