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
| Calc | Does |
|---|---|
| Running Total | Cumulative sum along the view |
| Percent of Total | Each mark's share of the whole |
| Difference | Change from the previous mark |
| Percent Difference | The change as a percentage |
| Rank | Order marks by value |
| Moving Average | Smoothed 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:
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 separatelyGetting this direction right is the whole game with table calcs.
WINDOW & LOOKUP functions
RUNNING_SUM(SUM([Sales])) cumulativeWINDOW_AVG(SUM([Sales]), -2, 0) 3-period moving averageLOOKUP(SUM([Sales]), -1) the previous mark's valueSUM([Sales]) - LOOKUP(SUM([Sales]), -1) difference from previousRANK(SUM([Sales])) rank of each markINDEX() 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
- 01Table calcs compute across the aggregated result in the view (running total, % of total, rank).
- 02Addressing = the dimensions the calc runs along; partitioning = the dimensions it resets across.
- 03"Compute Using" sets the direction — getting it right is the whole skill.
- 04Most table-calc bugs are the wrong direction, not a wrong formula.
- 05Write them with RUNNING_SUM, WINDOW_AVG, LOOKUP, RANK and INDEX.
