Toan Hoang

INDEX() Table Calculation

The INDEX() function returns the index of the current row in the partition, without any sorting with regard to value. The first-row index starts at 1. For example, the table below shows quarterly sales. When INDEX() is computed within the Date partition, the index of each row is 1, 2, 3, 4…, etc. so let us go through an example in Tableau you so you can really see what this means.

Note: I use the INDEX() function in pretty much every worksheet I build.

Worksheet

We are going to be a worksheet that will allow us to see the INDEX() function in action.

Note: There are quite a few fun data sets there so do have a look around. You can also find some nice data sets on Google Dataset search: https://toolbox.google.com/datasetsearch

In a basic sense, you can see the number of records for each team for each world cup year. This is pretty simple stuff, but now let us drag the Index Calculated Field onto Text and see what happens. Now the whole table should be full of numbers which indicates the position depending on how it is calculated.

My common usages for the INDEX() function includes:

You can read more about the INDEX() function here:

Exit mobile version