14 Replies Latest reply on May 15, 2013 12:54 PM by Shawn Wallwork

# Divide values of one dimension by values of another

Hi!

I am stumped by this one. In this example where I have masked the names and changed the data, how can I divide the values of Domain 2 for "Domain Visits" by the values of Domain 1. Essentially the visits to domain 2, 3 and 4 are subsets of Domain 1.

 Domains Domain Visits % of Domain visits Total Domain Visits Domain 1 90 0.30% 3000 Domain 2 15 0.50% 3000 Domain 3 6 0.20% 3000 Domain 4 3 0.10% 3000

Regards,

Chris

• ###### 1. Re: Divide values of one dimension by values of another

Where are you getting total domain values from - is it in your dataset on each row?

• ###### 2. Re: Divide values of one dimension by values of another

No, it's its own column in my Excel spreadsheet. My column headers are:

Domain name  / Visits / Page Views / Total domain

• ###### 3. Re: Divide values of one dimension by values of another

Hi Chris,

One way to do this is to create a couple of calculated fields.

Domain1 Visits:

if [Domains]='Domain 1' then [Domain Visits] end

Domain2 Visits:

if [Domains]='Domain 2' then [Domain Visits] end

Domain1 divided by Domain2:

sum([Domain1 Visits])/sum([Domain2 Visits])

The domains field should not be on the view.

Hope this helps!

-Tracy

1 of 1 people found this helpful
• ###### 4. Re: Divide values of one dimension by values of another

Sorry for the delay getting back to you on this, Tracy. I tried what you suggested above and I am not sure where I should place the pills in my display.

-Chris

• ###### 5. Re: Divide values of one dimension by values of another

Tracy,

How would I modify the calculation to make queries match specific letter combinations? For example, I want to see all values for values that contain text 'Domain 1" (there doesn't have to be an exact match, it just needs to contain this phrase).

Regards,

Chris

• ###### 6. Re: Divide values of one dimension by values of another

This is fascinating. Chris your started this thread in Oct. 2012 and you're still at it in May 2013. And so far it doesn't look like anyone has asked if you could possibly post a packaged workbook with a bit of sample data. Chris, post a workbook and I'm fairly sure this can be solved.

1 of 1 people found this helpful
• ###### 7. Re: Divide values of one dimension by values of another

This example won't make sense with the data used (Sample - Coffee Chain (Access)), but would require functionality that I need for my view to work.

So, for example:

1) I want to create a new column and divide Profit by Sales where the State is Florida.

2) In the same view, I then want to divide Marketing by Sales where the state is Georgia.

3) In the same view, I want to list out Profit, Sales and Marketing for all states.

• ###### 8. Re: Divide values of one dimension by values of another

Chris did you forget to attach a file?

• ###### 9. Re: Divide values of one dimension by values of another

My example uses the Sample - Coffee Chain (Access) data that is already included with Tableau.

• ###### 10. Re: Divide values of one dimension by values of another

Hey Chris, it's finally cocktail hour so this will have to wait until tomorrow. Ping me if I forget. Thanks,

--Shawn

• ###### 11. Re: Divide values of one dimension by values of another

Hi Shawn,

Would be grateful for any help that you can provide here.

Regards,

Chris

• ###### 12. Re: Divide values of one dimension by values of another

Chris thanks for the reminder. See attached.

--Shawn

PS: No Georgia in Coffee, so I put in the Land Of Enchantment instead.