4 Replies Latest reply on Oct 20, 2016 9:17 AM by Jason Olson

# Problem with division

Hi All,

I am running into problem with division in my tableau workbook. I tried some of the suggestion already posted on the forum like aggregating my num and den but it doesn't seem to be working.

I am attaching twbx file with this post.

In this sheet 'Column Test pacing' is a division of two aggregated fields but the result returned are not correct.

I would really appreciate any help with this.

Thank You

• ###### 1. Re: Problem with division

Hi Raveesh, try changing your [Test Pacing] calc field to this:

SUM([Num Impressions])/MIN([Booked Impression Test])

It looks like your [Booked Impression Test] is a value whose final value is stored in each record--that is, the correct denominator value is not a SUM(), but rather just the per-record value. [Num Impressions], on the other hand, appears to need to be summed. If that's the case, then using MIN() on [Booked Impression Test] will give you the per-record value. You could also use ATTR(), AVG(), or MAX().

• ###### 2. Re: Problem with division

Because your Booked Imipression Test is acting more as an attribute it doesn't need to be aggregated. Instead you should use ATTR. Below is the calculation you can use:

SUM([Num Impressions])/ATTR([Booked Impression Test])

• ###### 3. Re: Problem with division

This is what are you expecting ?

I have changed the calculation like below.

[Num Impressions]/[Booked Impression Test]

• ###### 4. Re: Problem with division

You actually don't even have to do that much. Instead of:

SUM([Num Impressions])/SUM([Booked Impression Test])

Make the calculated field the following:

SUM([Num Impressions])/ATTR([Booked Impression Test])