Table Calculations are performed within Tableau as opposed to other calculations where processing is done at the data source.
Table Calculations can be created by using Table calculation functions or by using Quick Table Calculations.
Quick Table Calculations are most commonly used Table Calculations and are pre-defined by Tableau.
When using Table Calculations, it is important to understand the concept of Addressing and Partitioning.
Addressing and Partitioning fields are dimension fields used to create a view.
Addressing fields define the direction of the calculation.
Partitioning fields define the scope of the calculation.
These fields can be identified by Compute Using functionality.
I will use an example, to explain the concept of Addressing and Partitioning fields.
Understanding Addressing and Partitioning fields in Table Calculations
- Create a workbook and connect to Sample-Superstore.xls.
- Place Segment and Region on Rows.
- Place Order Date on Columns and Sales on Text. This will create a Text table.
- Right click on Sum(Sales) on Text and create a quick table calculation for Running Total.
5. Right-click on Sum(Sales) again and select Edit Table Calculation. In the Edit Table Calculation box, under Compute Using, select the different ways in which computation can be done. Default is Table(across).
6. Check Show calculation assistance at the bottom. This will highlight the fields based on Compute Using and will help in understanding the calculation.
7. With Table (across) selected, check your table in the view. The highlighted row will show the direction of computation.
In this case Year is the Addressing field because that is the calculation of the calculation.
Segment and Region are the partitioned fields as the calculation is partitioned or grouped on these fields.
If you would write a SQL statement for the above calculation, the first column will closely resemble to the following:
Select Sum(Sales), Segment, Region
where Year(Order Date) = ‘2015’
Group By Segment , Region;
Check other options, such as Table(down), Table(across then down) etc. in Compute Using and see how the computation changes.
For more details on this and other advanced Tableau concepts, check out the book – Tableau Unlimited on Amazon.com
If you have any questions on this, please post your comments below.