Tableau Table Calculations: Compute Using Calculator
This calculator demonstrates how Tableau table calculations compute using different scopes. Enter values into the mock data table, select a ‘Compute Using’ option, and see how the ‘Running Sum’ results change.
Input Data Table
Results: Running Sum
Final Calculated Value
The calculation sums values across the entire table, moving across columns then down to the next row.
| Category | 2021 Sales | 2022 Sales |
|---|---|---|
| Furniture | 100 | 250 |
| Technology | 450 | 700 |
What is “Tableau Table Calculations Compute Using”?
In Tableau, a table calculation is a special type of calculation that operates on the data currently visible in a visualization. Unlike regular calculated fields that work on a row-level basis in your data source, table calculations are performed only after Tableau has queried the data and aggregated it for the view. The Compute Using setting is the most critical part of a table calculation; it tells Tableau the direction and scope of the calculation.
Essentially, you must tell Tableau which dimensions in the view define the scope of data for the calculation (partitioning) and which dimensions define the direction of the calculation (addressing). The ‘Compute Using’ option is a user-friendly way to control these addressing dimensions.
The Formula and Explanation of Tableau Table Calculations Compute Using
There isn’t a single mathematical formula for ‘Compute Using’ itself. Instead, it’s a directive that controls how a specific table calculation function (like RUNNING_SUM, PERCENT_OF_TOTAL, etc.) operates. The conceptual formula is:
TABLE_CALCULATION([Measure], 'Compute Using' -> [Addressing Dimensions])
When you select a ‘Compute Using’ option, you are choosing the “addressing” dimensions. The remaining dimensions in the view become “partitioning” dimensions, which create boundaries for the calculation. For example, if you compute a running sum using “Table (Down)”, the calculation moves down the rows, and restarts for each new column if there are column dimensions.
Here in our calculator, we are simulating RUNNING_SUM([Sales]).
Variables Table
| Variable | Meaning in this Calculator | Unit | Typical Range |
|---|---|---|---|
| Input Value | A measure like Sales, Profit, or Quantity for a specific intersection of dimensions. | Unitless (or Currency, etc.) | Any positive number |
| Compute Using | The direction and scope for the table calculation. It determines the addressing dimensions. | Categorical | Table (Across), Table (Down), Pane (Down), etc. |
| Partition | The boundary for the calculation. The calculation restarts for each new partition. This is defined by the dimensions *not* selected in ‘Compute Using’. | N/A | N/A |
Practical Examples
Example 1: Compute Using ‘Table (Down)’
This computes the running total down each column independently.
- Inputs: Furniture 2021: 100, Tech 2021: 200.
- Logic: The calculation for 2021 starts at 100 (Furniture) and adds 200 (Technology), resulting in 300. It then does the same for the 2022 column independently.
- Results (2021 column): Cell 1: 100, Cell 2: 300 (100 + 200).
Example 2: Compute Using ‘Table (Across)’
This computes the running total across each row independently.
- Inputs: Furniture 2021: 100, Furniture 2022: 150.
- Logic: The calculation for the Furniture row starts at 100 (2021) and adds 150 (2022), resulting in 250. It then does the same for the Technology row independently.
- Results (Furniture row): Cell 1: 100, Cell 2: 250 (100 + 150).
How to Use This Tableau Compute Using Calculator
- Enter Data: Input numerical values into the 2×2 grid. These represent a basic data table in Tableau, with “Category” on rows and “Year” on columns.
- Select Compute Using Option: Choose how the calculation should run from the dropdown menu. This is the core of experimenting with tableau table calculations compute using.
- View the Results: The “Results: Running Sum” table updates automatically, showing how the `RUNNING_SUM` function behaves with your selected scope.
- Analyze the Final Value: The highlighted primary result shows the very last value calculated in the sequence.
- Interpret the Chart: The bar chart provides a visual representation of the values in the results table, making it easier to see the pattern of the calculation.
Key Factors That Affect Tableau Table Calculations
- View Dimensions: The number and arrangement of dimensions on your Rows and Columns shelves determine the possible partitions and addresses.
- Partitioning vs. Addressing: This is the fundamental concept. Dimensions you compute using are ‘addressing’ (the path). Dimensions you don’t compute on are ‘partitioning’ (the walls).
- Calculation Type: A `RUNNING_SUM` behaves differently from a `PERCENT_OF_TOTAL` or `RANK`. The function itself dictates the math.
- Sort Order: The order of your dimension members can change the result of calculations like `RUNNING_SUM` or `RANK`.
- Specific Dimensions: For complex views, you can go beyond the basic options and check specific dimensions to use for addressing, giving you full control.
- Relative vs. Fixed: Some calculations also have a “Relative to” option (e.g., Previous, Next, First, Last) which further refines the logic.
For more details on different calculation types, you can explore Tableau’s official documentation on Table Calculation Types.
Frequently Asked Questions (FAQ)
- What is the difference between a table calculation and a calculated field?
- A calculated field computes at the data source level (row-level or aggregate). A table calculation computes locally only on the aggregated data visible in the worksheet.
- What is the default ‘Compute Using’ setting?
- The default is typically ‘Table (Across)’, but Tableau can sometimes change it based on the structure of your view.
- What does ‘Pane’ mean in ‘Compute Using’?
- ‘Pane’ refers to a sub-section of your table. If you have multiple dimensions on a shelf, the inner-most dimension creates panes. For example, with Year and then Quarter on columns, the calculation could restart for each Year.
- When would I use ‘Table (Across then Down)’?
- You use this when you want a single, continuous running total that snakes through the entire table, moving left-to-right on the first row, then dropping to the second row and continuing left-to-right, and so on.
- Can table calculations slow down my dashboard?
- Yes. Because they are performed locally on the aggregated data, complex table calculations on very large crosstabs can impact performance. However, they are often more efficient than complex Level of Detail (LOD) expressions.
- How do I save a table calculation?
- You can drag a pill that has a table calculation on it from your view into the Data Pane on the left. This saves it as a new calculated field that you can reuse.
- What are ‘Quick Table Calculations’?
- These are shortcuts in the right-click menu (e.g., ‘Running Total’, ‘Percent of Total’) that apply a common table calculation with default settings.
- Can I use my own formula in a table calculation?
- Absolutely. You can write complex formulas using functions like
WINDOW_SUM(),RANK(),LOOKUP(), andPREVIOUS_VALUE()to create custom table calculations beyond the “quick” options. To learn more, check this Tableau Table Calculation Basics guide.
Related Tools and Internal Resources
Explore these related topics for more data analysis insights:
- Tableau vs. Power BI Comparison: A detailed look at the leading BI tools.
- Understanding Level of Detail Expressions: Dive into another powerful Tableau calculation type.
- Data Visualization Best Practices: Learn how to create effective and insightful charts.
- SQL for Data Analysis Guide: Brush up on the database query language that powers tools like Tableau.
- Advanced Charting Techniques: Discover new ways to visualize your data.
- Dashboard Performance Optimization: Tips for making your Tableau dashboards faster.