3 Replies Latest reply on Jul 31, 2016 2:03 AM by Yuriy Fal

# Divide the sum of one category by another

Hi all,  I'm new to Tableau and I've been trying to work this out but I can't seem to get it right.  My sample data attached consists of 3 cities and 2 categories for each city.  The first category has 15 "keywords" in it and each of those keyword has 13 "volume" data points associated with it (for 13 points in time). These volume data points are specific to the city as well.  The second category has 5 keywords in it, each with the same number of volume data points.

What I'm trying to do is, for each city and for each of the 13 points in time, divide the sum of the volume for category 1 by the sum of the volume for category 2.  In the attached workbook on sheet 1, I'd like a calculation that sums up the "general category" for Atlanta (=1190) and divides that by the sum of the "population" category for Atlanta (=1180). I'd like it to do this for each respective city AND for each of the 13 months.

Sheet 2 shows what I want to see, except I want the 3 bubbles to be those new calculations (ie, category 1 divided by category 2).

Is this possible?

Any help is greatly appreciated!  Thanks!

• ###### 1. Re: Divide the sum of one category by another

Hey Joe,

I think you'd need to creates fields that gives you the sum for a particular category  SUM(IIF([Category]='General,[Your Measure],0)) then create another field where you divide the sum of one cat by the other.

Good luck,

Ivan

• ###### 2. Re: Divide the sum of one category by another

Wrong solution

• ###### 3. Re: Divide the sum of one category by another

Hi Oleg,

The topic question is rather old, anyway...

Actually, what Ivan Young has been suggested could lead to the solution.

Definitely, not the solution (the only one), as we would usually find

with Tableau there are multiple paths to the final destination available.

Following Ivan's path, one could build the calculations (as in the attached).

So could you, too.

Yours,

Yuri