KNOWLEDGE BASE

Unexpected Results When Using Index Calculations


Published: 30 Oct 2017
Last Modified Date: 01 Nov 2017

Issue

When filtering a view using a table calculation, an INDEX() expression used to display a row count does not update as expected.

Environment

  • Tableau Desktop 10.4
  • Windows 10
  • MS SQL Server

Resolution

Create a calculated field that assigns a value of 1 to the rows that are returned from the filter, and then create a Running Sum calculated field to simulate the correct INDEX values in the view.

The following formula can be reviewed in the attached workbook Refactor Index Example.twbx (10.4). 

RUNNING_SUM(IF [Filter]<=20 THEN 1 END)

The above calculated field checks the "Filter" value assigned to each row. If that value is less than the specified range, in this case 20, a value of 1 is assigned to the row. Using a Running Sum table calculation, we can then increment by 1 for each row, displaying the desired index.

Cause

Table Calculations in the view are evaluated prior to table calculations on filters.
Did this article resolve the issue?