5 Replies Latest reply on Jul 24, 2017 2:19 PM by Paulo Wang

# 2+2=6 - Three different ways of calculating the same answer, which is giving different results

Hi All,

I am having an issue with my calculation where I am trying to get the same answer in three different ways. however, each way it is giving me a different answer.  I have done the search on the forums and I was not able to find the answer I was looking for.  I figure the community here would be able to help me point me in the right direction to try to understand what is going on.

However, each way it is giving me a different answer.  I have done the search on the forums and I was not able to find the answer I was looking for.  I figure the community here would be able to help me point me in the right direction to try to understand what is going on.

Here is the simplified example:

I have the following:

Calculated Field "A" = Formula A

Calculated Field "B" = Formula B

Calculated Field "C" = Formula C

Calculated Field "ABC" = [A] + [B] + [C]

Calculated Field "Formula ABC" = Formula A + Formula B + Formula C

If I manually add the values with a calculator from the results from Calculated Field "A", Calculated Field "B", and Calculated Field "C", it will give a different number than the one output from Calculated Field "ABC", which is also different from the result in Calculated Field "Formula ABC", which is using the same exact formulas as Calculated Field "A", Calculated Field "B", and Calculated Field "C".

Here are the actual outputs from my worksheet:

 Measure Names Measure Values A \$0.00 B \$275.92 C \$4.88 ABC \$279.17 Formula ABC \$275.92

Shouldn't all of them give the same answer?  I have a feeling that it has something to do with how information is aggregated and there might be a need to use LOD expressions here. I don't understand why this is the case and would like some help with explaining why this is happening and/or how to fix this.

Thank for the help everyone.  I appreciate it.

• ###### 1. Re: 2+2=6 - Three different ways of calculating the same answer, which is giving different results

It really depends on if you're mixing aggregates.

Can you please attach a sample workbook so we can replicate?

• ###### 2. Re: 2+2=6 - Three different ways of calculating the same answer, which is giving different results

Here is the workbook that I have with the anonymized data.

The difference is the actual names of the formulas.

Calculated Field A = Shift-Differential Pay Modifier

Calculated Field B = Fringe Pay Modifier

Calculated Field C = WorkStudy Pay Modifier

Calculated Field ABC = Pay Modifier Total

Calculated Field "Formula ABC" = Pay Modifier

• ###### 3. Re: 2+2=6 - Three different ways of calculating the same answer, which is giving different results

I.e. Pay Modifier Total is not A+B+C, it's only calculating A+B in Tableau.

Then outside of that you're wondering why 'Pay Modified' doesn't equal Pay Modifier Total but the reality is the calculations are very different.

The calculation for 'Pay Modifier' is not the equivalent of the formulas inside of each a+b+c - you're doing conditional logic in this formula on 'class enrolled' which isn't occurring in the pay modifier total field or any of the a, b or c formulas.

• ###### 4. Re: 2+2=6 - Three different ways of calculating the same answer, which is giving different results

Tom - I am going to recheck my formulas here and resubmit the worksheet.  Thx for the extra eyes on this.  I think that the logic might be off, which is causing the confusion.

• ###### 5. Re: 2+2=6 - Three different ways of calculating the same answer, which is giving different results

Tom - you are correct.  The logic on "Pay Modifier Total" was incorrect, thus causing confusion on the end result, which resulted in the assumption in the original post.

A fresh pair of eyes was able to help spot the issue.  Thx!