3 Ways to Use Index() in Tableau. index() function usecase | by Indhumathy Chelliah | May, 2022

index() operate use case

Photograph by Nothing Ahead from Pexels

In tableau, index() operate is among the most essential capabilities. Let’s be taught in regards to the 3 use instances of index() operate on this article.

  1. Easy methods to create a well-formatted tabular information view in tableau utilizing index() operate?
  2. Easy methods to de-identify any column names utilizing index() operate?
  3. Easy methods to create High-N / Backside N filter utilizing index() operate?

In tableau after we create a textual content desk, we’ll get merged cells.

Right here view breaks down by Class and Subcategory. However if you wish to have a person row for every file, it may be accomplished through the use of index() operate.

Create a calculated subject:

calculated subject index()

Now convert this calculated subject index to discrete. Now place this within the first place on the rows shelf.

Now we get a person row for every file. You may obtain my workbook from here.

Suppose we’ve got a use case that has to cover the subcategories title in our view.

What must be accomplished?

  1. If we choose a subcategory within the filter, then that subcategory title alone must be displayed within the view. The remaining different subcategories must be displayed as Product 1, Product 2, and so on. The remaining subcategories must be deidentified.
With out hiding the subcategory title

Now we’ve got to deidentify the sub-category title.

How it may be accomplished?

  1. Create parameter Subcategory and click on Add values from “Subcategory” variable. After creating the parameter, right-click and choose “Present Parameter”

2. Create a calculated subject to show names for subcategories.

If min([Subcategory])=min([Sub-Category])
then min([Sub-Category])
“Product “ + str(index())

For the chosen subcategory alone, it is going to show the precise title. For others, it is going to show names like “Product 1, Product 2.. and so on.

3. Now drag the calculated subject Consecutive_Numbers to the row shelf.

4. Click on the Subcategory within the row shelf and deselect Present header

5. Now if we choose a selected subcategory like “Storage”. It’ll show the title of that subcategory alone. The remaining it is going to show as “Product 1, Product 2.. and so on.

Hiding the Sub Class Title

This has been achieved utilizing index() operate. My workbook might be downloaded here.

We will simply create a High N filter / Backside N Filter utilizing index() operate


Let’s create a bar chart SubCatgeory vs Revenue. I’ve sorted them in descending order.

Let’s add an index as a label for our understanding. I’ve added index() to the label on the marks card.

Now we’ve got to create a High 5 filter.

Create a calculated subject — High 5 Filter

Now add this High 5 filter to the filter shelf and click on True.

Be certain that, we’ve got sorted the graph in descending order earlier than making use of the filter. If we type the graph in ascending order, it is going to work as the underside 5 filters.

We will reuse this filter for all sheets. That is a simple option to create a High N/Backside N filter.

You may obtain my workbook from here.

More Posts