6 Replies Latest reply on Jan 10, 2014 7:45 AM by Aaron Clancy

# Sum two moving sum measures

Hi

I have a table with two measures showing rolling 12 months totals (moving sums) by month, e.g. Products sold and products returned. Each month shows the total for the previous 12 months.

How do I perform a calculation on the two. Quite simply I want to work out the percentage of products returned against the products sold but in a rolling 12 months. The statement SUM([Products returned]/[Products sold] only peforms the calculation for the individual month and does not take into account the 12 month sum in each of the measure rows.

Thanks

• ###### 1. Re: Sum two moving sum measures

Can you post a sample packaged workbook (.twbx) file?  You can use the sample data provided with Tableau to create one that represents this scenario.  Then, we can help more readily.

• ###### 2. Re: Sum two moving sum measures

Is this something like what you're looking for?

• ###### 3. Re: Sum two moving sum measures

Hi Aaron. Yes exactly like that, i.e. last 12 months products sold, last 12 months products returned, % returned. Shown by month with each month being a rolling 12 month sum. Thanks

• ###### 4. Re: Sum two moving sum measures

Calcs

last 12 months products sold:          window_sum(sum([Products Sold]),-11,0))  //compute across

last 12 months products returned:   window_sum(sum([Products Returned]),-11,0))  //compute across

percentage:                                     [last 12 months products returned] /[last 12 months products sold] //compute across

• ###### 5. Re: Sum two moving sum measures

Thank you!

• ###### 6. Re: Sum two moving sum measures

No problem, glad to help