4 Replies Latest reply on Aug 11, 2018 6:00 AM by Nana Adasi

# How to divide measure values by each other in Tableau?

I am new to tableau and I am having a hard time trying to figure out if this can be done in tableau or with a custom SQL query.

Please see attached screenshot. I need to divide the values of 'Theresa over Audrey and multiply it by 100 to get the percentage.

Any help will be appreciated.

• ###### 1. Re: How to divide measure values by each other in Tableau?

HI Kwame,

Create a calculation field like below

(SUM(Sales)-Lookup(sum(sales),-2))/Lookup(sum(sales),-2)

The calculation will give the value like below

((15853-11996)/11996)*100 = 32.15

Drag it to Under Sum(Values) in measure values section you can see the value of 32.15 for  Theresa

Hope this helps kindly mark this answer as correct or helpful so that it will help others

BR,

NB

• ###### 2. Re: How to divide measure values by each other in Tableau?

Hi Kwame,

Naveen B' s answer will give you what you want. But I understand the usage of table calculations and Lookup functions from his answer might feel complicated.

You can use the following approach, for simpler understanding.

Assuming you want to compare how all the other groups are performing compared to Audrey. You need to create a calculated field that gives you only Audrey's sales as denominator.

You can create that as follows

Audrey Sales

Sum(

If [Product Name (group)] = 'Audrey'

then [Sales] else 0 end

)

Now you can create another calculated field that gives you the ratio of all users over Audrey

Ratio

Sum([Sales]) / [Audrey Sales]

P.S : When you want percentages, don't multiply with 100, because tableau will understand and show the fractions as percentages by changing the format of the field. You can see how to do that here - Format Numbers and Null Values

\

Also may I know, why is this calculation necessary? I am asking this because your data might be in a way that is not easy to create the calculation you are looking for.

• ###### 3. Re: How to divide measure values by each other in Tableau?

Thanks

• ###### 4. Re: How to divide measure values by each other in Tableau?

My client wants percentages displayed on the dashboard. From the mockup I was given they got to the figures by calculating it like how I presented it in the example screenshot. Thanks for your help