If you've ever tried to create advanced metrics in Tableau such as percent of total sales, running totals, or year-over-year growth, you've likely encountered Table Calculations. These are among Tableau's most powerful yet highly misunderstood features.
What Are Table Calculations?
A Table Calculation in Tableau is a computation that happens after the data has been aggregated and rendered in the view. In simple terms, Tableau first builds your visualization (with sums, averages, etc.), and then applies the table calculation to what's displayed on the screen.
This makes them view-dependent, meaning their result depends on what dimensions and measures are currently in your visualization, and even the layout of your table or chart.
For example:
- Calculating % of Total Sales by Category in a bar chart
- Displaying Running Total of Profit over months
- Showing Year-over-Year Growth across regions
These all rely on how your data is arranged in the view and not just in your dataset.
To understand why table calculations behave differently, it helps to remember Tableau's Order of Operations. Table calculations are one of the last steps Tableau perform. They occur after filters, aggregations, and LOD expressions.
That means:
- If you filter data out before a table calculation, it won’t appear in the computation.
- But if you use a Table Calculation filter (like a Top N based on INDEX()), Tableau calculates it after aggregations.
Understanding this order is key to troubleshooting “missing” data or strange results.
What Are the Most Common Types of Table Calculations?
Let's take a look at most commonly used Table Calculations.
- Running Total -> Tracks cumulative values over time.
If we want to find running sum of sales over months our calculation would be
RUNNING_SUM(SUM([Sales]))
Use case: Understanding growth trends or cumulative progress (total revenue YTD)
- Percent of Total -> Calculates how much each value contributes to the total.
To find percentage of sales by product category
SUM([Sales]) / TOTAL(SUM[Sales]))
Use case: Market shares, category contribution, or sales mix analysis.
- Difference and Percent Difference -> Shows how much a value changes relative to the previous row or column.
One of the examples is Month-over-month difference in profit
SUM([Profit]) - LOOKUP(SUM([Profit]), -1)
Or as a percent:
SUM([Profit]) - LOOKUP(SUM([Profit]), -1)) / LOOKUP(SUM([Profit]), -1
Use Case: Measuring change over time growth rate, or performance shifts.
- Rank -> Ranks values within a partition.
For example we can rank products by sales
RANK(SUM([Sales]))
You can adjust the “Compute Using” setting to rank across different dimensions either per region or category depending on your needs.
What is Compute Using Used for?
If you've ever clicked "Edit Table Calculation" and felt confused by Compute Using (Table Across, Table Down, Pane, etc.), you are not alone.
This setting defines the direction and scope of the calculation. In other words, what part of the table Tableau looks at to perform the computation.
- Table Across: Calculates horizontally (across columns)
- Table Down: Calculates vertically (down rows)
- Pane Across / Pane Down: Restricts calculation to each pane
- Specific Dimensions: Lets you manually choose which dimensions define the partition
Make sure to check the “Compute Using” setting when your table calculation doesn’t behave as expected. Changing the direction or dimensions often fixes the issue instantly.
These four examples: Running Total, Percent of Total, Difference/Percent Difference, and Rank represent the core building blocks of Table Calculations in Tableau. They help you analyze growth, contribution, change, and position within your data in a clear and flexible way.
