Skip navigation

Tableau Prep: Add Table Calculations - especially Index() and PreviousValue()

score 305
You have not voted. Active

This is my number one ask:

Please add Index() and PreviousValue() functions to Tableau Prep.  This would also require the ability to define a sort (covered by ) prior to the application of the function.


There are numerous use cases that require this functionality:

  • Row Numbering (also covered in
    • could be achieved with ZN(PreviousValue(0)) + 1    or    Index()
    • the location of a row of data can encode information about the data that is not available any other way
      • For example, the "last" row of a category may be the row that needs to be kept.
      • The first/last n records may need to be skipped. 
  • "Filling Down" a value that is present in one row, but not rows under it
    • could be achieved with IF ISNULL([field]) THEN PreviousValue([field]) ELSE [field] END
    • some file formats have "parent" rows that define an attribute for all children.  Tableau Prep currently cannot handle this use case.
  • Materializing a running value
    • For example (other examples exists), a file containing the bank account debits/credits for each day could have the actual day's balance calculated by Prep
      • PreviousValue(0) + [value]
      • True, it can be done with table calcs in Tableau, but it is a very fragile solution because any filtering can break the running sum - the entire history has to be in the view.
  • Ranking / Top or Bottom N (ranking was announced at TC19)
    • Having the ability to sort and then apply and Index() would allow for simple ranking.  PreviousValue() could allow for additional logic around ties, density, etc...


There are other use cases as well.  Some of these may be candidates for building in a feature (e.g. adding a Row Number to a flat file source or having an option to skip the first n records), but the flexibility and power provided by Index() and PrevoiusVlaue() functions could not be replicated by simply handling each use case above with a new feature.


[Edited 20180503 to reference related Ideas]

[Edited 20191126 by Jonathan Drummey to mention that ranking was announced at TC19]


Vote history