2 Replies Latest reply on Feb 13, 2013 10:33 AM by Pete Staley

# Dividing Sum by an Offset of another Sum

Hello,

New Tableau user here. I am trying to divide the sum from one measure by yesterday's sum of another measure. For example:

• On 2/1/13 I have 10 apples
• On 2/2/13 I have 5 pears

How can I divide the 5 pears by 10 apples? In addition, I'd like to see the other similarly defined calculations, such as:

• 2/8/13 pear total divided by 2/1/13 apple total (7 day intervals)

- Pete

• ###### 1. Re: Dividing Sum by an Offset of another Sum

Pete,

You can do this kind of calculation using a table calculation.  Specifically you'll want to use LOOKUP.

For yesterday to today, you can use:

LOOKUP(SUM([Amount]), -1) / LOOKUP(SUM([Amount]), 0)

For last week to today, you can use

LOOKUP(SUM([Amount]), -7) / LOOKUP(SUM([Amount]), 0)

I've attached a workbook so you can see.  You might also want to search the knowledge base for table calculations.

Joshua

• ###### 2. Re: Dividing Sum by an Offset of another Sum

Thanks Joshua, this is exactly what I needed.