KNOWLEDGE BASE

Unexpected Results When Running or Rolling Total of Another Calculation


Published: 26 May 2017
Last Modified Date: 31 May 2017

Question

When creating a rolling or running total of another calculation then the results may not be the expected results. Typically this issue occurs when the nested calculation is non-additive, like a ratio.
 

Environment

Tableau Desktop

Answer

Wrap each piece of original calculation in a table calculation.

For example, the following calculation:
WINDOW_SUM( SUM( [Profit] ) / SUM( [Sales] ), -11, 0 )

Would become:
WINDOW_SUM( SUM( [Profit] ) ), -11, 0 )
/
WINDOW_SUM( SUM( [Sales] ), -11, 0 )

Additional Information

When the entire profit ratio expression is wrapped in WINDOW_SUM(), then Tableau Desktop will find the profit ratio for every partition in the view and then total together the profit ratios for the rolling 12 partitions.
 
Did this article resolve the issue?