Skip to main content
Albero Academy

Table Calculations in Depth

Calculate across the view — running totals, percent of total, rank and difference, plus the addressing and partitioning that control them.

Chapter 12Tableau17 min readBeginner friendly
  • #Tableau
  • #Table Calculations

Table calculations compute across the results already shown in a view — a running total, each bar's percent of the whole, a rank. They're powerful but confusing until you grasp addressing and partitioning: which marks the calculation runs across. This chapter demystifies them.

What are table calcs?

Unlike calculated fields (which work on the data), table calcs work on the aggregated result table in the view. Add one by right-clicking a measure pill → Quick Table Calculation, or write one explicitly.

Quick table calcs

CalcDoes
Running TotalCumulative sum along the view
Percent of TotalEach mark's share of the whole
DifferenceChange from the previous mark
Percent DifferenceThe change as a percentage
RankOrder marks by value
Moving AverageSmoothed trend

Addressing & partitioning

The key concept: a table calc runs along some dimensions (addressing) and resets across others (partitioning). "Compute Using" sets the direction — Table (across), Pane, or a specific dimension:

running total, two ways
A running total of Sales by Month, split by Region:
• Compute Using "Table (across)" → cumulates across ALL months+regions
• Compute Using "Month" → cumulates within each region separately
Getting this direction right is the whole game with table calcs.

WINDOW & LOOKUP functions

writing table calcs
RUNNING_SUM(SUM([Sales])) cumulative
WINDOW_AVG(SUM([Sales]), -2, 0) 3-period moving average
LOOKUP(SUM([Sales]), -1) the previous mark's value
SUM([Sales]) - LOOKUP(SUM([Sales]), -1) difference from previous
RANK(SUM([Sales])) rank of each mark
INDEX() position number of the mark

Practice

Build a running total of sales by month and switch its "Compute Using" between Table and a partition dimension to see the difference. Add a percent-of-total, a month-over-month difference with LOOKUP, and a 3-month moving average with WINDOW_AVG.

Key takeaways

  1. 01Table calcs compute across the aggregated result in the view (running total, % of total, rank).
  2. 02Addressing = the dimensions the calc runs along; partitioning = the dimensions it resets across.
  3. 03"Compute Using" sets the direction — getting it right is the whole skill.
  4. 04Most table-calc bugs are the wrong direction, not a wrong formula.
  5. 05Write them with RUNNING_SUM, WINDOW_AVG, LOOKUP, RANK and INDEX.