5 Replies Latest reply on Feb 17, 2016 1:40 AM by Sabine Honer

# Percentage calculation didn't work because of divisor ( wrong aggregation level)

Hi All,

unfortunately I didn't get a calculation to work in Tableau :-(

May data looks like that

 Category 1 Category 2 Value 1 Value 2 A x 473 29 A x 314 42 A x 334 27 A x 142 33 A x 495 18 A x 436 41 A x 274 22 A x 259 42 A y 167 22 A y 108 10 A y 445 37 A y 245 41 A y 446 22 A y 329 31 B x 208 33

I created a calculation in Tableau saying ([Value 1]-[Value 2])/[Value 1] for both categories.

Output works for Category 1 = B as I have only one value.

I also tried to use  (sum([Value 1])-sum([Value 2]))/sum([Value 1] ) => but for Tableau calculation isn't valid.

I am thankful for any kind of hints.

If you have questions, please let me know.

Best regards

Sabine

• ###### 1. Re: Percentage calculation didn't work because of divisor ( wrong aggregation level)

What are you expecting the output to yield?  The calc is doing exactly as expected when I looked at it.

• ###### 2. Re: Percentage calculation didn't work because of divisor ( wrong aggregation level)

This is working:

(SUM([Value 1])-sum([Value 2]))/sum([Value 1])

1 of 1 people found this helpful
• ###### 3. Re: Percentage calculation didn't work because of divisor ( wrong aggregation level)

I tried that several times :-(

I will try it once more.

I found that workaround: ([Value 1]-[Value 2])/{include [Category 2]:Sum([Value 1])}

By the way: How did you get the values in different columns? ( sorry for that Newbie question).

Best regards

Sabine

• ###### 4. Re: Percentage calculation didn't work because of divisor ( wrong aggregation level)

Hi Sabine-

You don't need that LOD work around.  I am suspecting the pill turned red after you added the sum aggregation?  That is just because T originally was aggregating the calc field and then you defined the agg in the calc.  The pill turns red because you cannot aggregate an aggregate.  You just need to remove the red pill and drop the field back into your view.

You can utilize measure values/measure names to get different columns.

1 of 1 people found this helpful
• ###### 5. Re: Percentage calculation didn't work because of divisor ( wrong aggregation level)

thank you very much.

That is exactly what happened!