KNOWLEDGE BASE

Unexpected Numbers Returned When Filtering the view by a Table Calculation


Published: 19 Aug 2016
Last Modified Date: 19 Sep 2017

Issue

When filtering by a table calculation, then a table calculation in the view is showing unexpected numbers.

For example, in a Top N view created with a filter on RANK(SUM([Sales])), there may be a running sum of sales that shows unexpected results.

Environment

Tableau Desktop

Resolution

Add the filter condition to a calculated field for the table calculation. For example:
RUNNING_SUM(
IF RANK( SUM( [Sales] )) <= 5
THEN SUM( [Sales] )
END

The above calculation will return the expected running sum of sales for customers with a rank of 5 or above.

Cause

The table calculation in the view is being calculated before the view is being filtered by the other table calculation.

For example, Tableau Desktop will calculate the running sum of sales for all customers and then show only the customers with a rank of 5 or higher.
Did this article resolve the issue?