3 Replies Latest reply on Jan 29, 2014 7:58 AM by . Indumon

# Calculating Measure within Dimension

I've got a Dimension say "Event" that has 2 categories Views and Purchases.  This works with my measure Values.  The data looks similar to this

ViewsPurchases
7525
250125

I'd like to create a rate that is Purchases / Views but can't seem to figure out how to create the calculate field in tableau.

When I put just the Dimension and Measure into a table and do a table calculation of "Percent from" + "Across" I get the values I want, but I  have 2 Measures I'd like to work with and put on the same axis which seems impossible without creating a calculated field.

It's basically

Event = Purchase [Values] / Event = Views [Values].

Any suggestions would be greatly appreciated.

• ###### 1. Re: Calculating Measure within Dimension

Hi Tatiana,

Can you create a new calculated field that is:

sum([Purchases])/sum([Views])

If not, are you able to post a sample workbook?

-Tracy

• ###### 2. Re: Re: Calculating Measure within Dimension

Hi Tracy,

Unfortunately Purchases and Views isn't available because they're under the "event" dimension.  The data pull looks like this

DateEventValues
1/1/2013

Views

75
1/2/2013Views82
1/1/2013Purchases25
1/2/2013Purchases40
1/3/2013Views90
1/3/2013Purchases65
• ###### 3. Re: Re: Re: Calculating Measure within Dimension

Hi Tatania,

You have to create two calculated fields.

Purchases=If [Event]='Purchases' then [Values] End

Views=If [Event]='Views' then [Values] End

then do the third calculation conversion = Sum(Purchases)/Sum(Views)