Tableau Table Calculations are the special type of calculated field. Unlike regular calculated fields, table calculations in Tableau are based on the data that is currently visualized in a report. In this article, we will show you, How to create Tableau table calculations, and how to use their properties with an example.
For these Tableau Table calculations demonstration, we are going to use the data present in the Global Super Store Excel Worksheet. So, Please refer Connecting to Excel Files article in Tableau to understand the connection settings.
Before we start creating Table Calculations in Tableau, let me create a Table Report.
Create Tableau Table Calculations
In Tableau you can create table calculation in multiple ways, and the first approach is: Right click on the measure, and select Create -> calculated Fields.
The second approach, please navigate to Analysis Tab and select Create Calculated Field… option as shown below.
Selecting the Create Calculated Field… option will open the following window. Here, we renamed the default calculation name as Cal. Below statement will find the First records in this data.
Here, you can click OK to close this window
Or you can click Default Table calculation hyperlink to alter the default settings. Clicking that link will open following window.
Use this window to change the Calculation field, Levels etc. I am not a fan of doing any modifications in this window. However, you can do it.
Let me click Cancel button to close Table calculation window, and then click OK button
Let me drag this first table calculation to Measures shelf in Tableau design area.
Edit Tableau Table Calculations
Click the down arrow, and select the Compute using to change the computing options.
Let me show you the list of available options in the table Calculations. For this, let me select the Edit Table Calculation option from the context menu.
This will open a new window called Table calculation.
Tableau Table Calculation – Table Down
It will start calculating from the first row to end row in a complete table.
It will calculate from the first row to end row in a Pane or group. From the below screenshot, First is applying for each quarter.
You can use your own dimension column to compute the table calculation. From the below screenshot, it is applying the FIRST function for each year.
You can also change the Sort order, and sorting column
Let me add Segments filed to Columns shelf to explore few more options in the Table Calculations.
From the below screenshot, you can see, it is displaying a few more options.
Tableau Table Calculation – Table across
It will apply the first function for each row in a table.
Tableau table across then down
It will apply the first function for each row in a table and then go to the next row.
Tableau Table down then across
It will apply the first function for each row in a column and then go to the next column.
Tableau Pane Down
As we said before, it will calculate from the first row to end row in a Pane or group.
Tableau Pane Down then down
It will calculate from the first row to end row in a Pane or group.
Tableau Table Calculation – Specific Dimension
As we said before, use your own dimension to compute the table calculation. From the below screenshot, it is applying the FIRST function for each quarter.
Here, the FIRST function is calculated for each quarter and segment.
Here, the FIRST function is applied for each year and segment.