3 Replies Latest reply on Jun 19, 2012 9:21 AM by Jonathan Drummey

# Simple ratio calculation?

This is probably embarrassingly simple but: How do I divide one row with another?

One row contains hours, another the number of hits. How do I calculate the number of hours spent for each 'hit', i.e. hours / hits?

I have used Tableau's reshape data add-in for Excel to put the dimensions in one column and all values (for the different dimensions) in another column. That makes good sense until I need to seperate out the hours values from the value column and divide it with the hits values from the values column... With this setup the support on calculated fields does not make sense, as I do not have a field called 'Hours' or 'Hits'.

Hope I'm making sense, and yes, I have checked tutorials and the support forum ;-)

Any help appreciated!

Albert

• ###### 1. Re: Simple ratio calculation?

Hi Albert,

Would you be able to repost your workbook saving it as a twbx file?

-Tracy

• ###### 2. Re: Simple ratio calculation?

Sorry, here is the tbwx file.... :-)

Thanks!

Albert

• ###### 3. Re: Simple ratio calculation?

Hi Albert,

This is a case where reshaping the data makes the analysis more difficult. To get a text table to show Hits, Hours, and the Ratio, you need three calculated fields:

Hits w/formula IF [KPI] = "Hits" Then [Value] END

Hours w/formula IF [KPI] = "Hours" Then [Value] END

Hours:Hits w/formula SUM([Hours])/SUM([Hits])

Then you can use Measure Names/Values to create the text table, as in the attached.

Jonathan