Table Functions in Tableau: How They Work

Formulas & functions · Updated November 22, 2026

In Tableau, table functions are functions used in table calculations to compute results across the values currently displayed in a visualization. They support calculations such as running totals, ranks, moving averages, and period-over-period differences; their results depend on how the view is arranged and how Tableau is told to calculate across it.

What Tableau means by table functions

Tableau documentation and menus generally call these table calculation functions. The word table can be misleading: the calculation does not simply run over every row in the underlying database table. It runs over the aggregated marks in a worksheet—the plotted or tabulated values that make up the current view. A mark might represent one month, one product category, or a combination of dimensions, depending on what is in the view.

For example, a worksheet with month on Columns and sales on Rows may show one sales value per month. A running-total calculation uses those displayed monthly values in sequence. Add Region to Color, and Tableau may calculate a separate running total for each region. Change the view’s dimensions, sorting, or calculation direction, and the result can change even though the calculation itself has not.

Table calculations are especially useful when the question is about the relationship between marks: how a value compares with the previous mark, how far a cumulative total has progressed, or how a value ranks within a group. They are not a general substitute for calculations over source records or for every kind of aggregation.

How table calculations work

A useful mental model is that Tableau first queries and aggregates data to create the marks in a view, then evaluates a table calculation over those marks. The calculation needs instructions about which marks to traverse and where to restart. Tableau calls these settings addressing and partitioning. They are why the same formula can produce different results in different worksheets.

Suppose a view contains monthly sales for several regions. To create a cumulative total for each region, Tableau needs to address the months in order and partition the calculation by region. It traverses the months, then begins again for the next region. If it instead addresses region, the calculation will run across regions rather than along the months.

Some table calculations use a position or a neighboring value, while others aggregate a window of marks. In Tableau, a table calculation can also be used inside a larger calculated field. The field’s expression defines the calculation; the worksheet’s settings define how its marks are evaluated.

Common table calculation functions

The functions fall into several practical groups. The expressions below are Tableau calculated-field syntax; fields such as Sales must exist in the data source.

  • Running calculations: RUNNING_SUM(SUM([Sales])) adds sales as the calculation moves through the addressed marks. Related functions include RUNNING_AVG, RUNNING_COUNT, RUNNING_MIN, and RUNNING_MAX.
  • Ranks: RANK(SUM([Sales])) ranks each mark’s sales within its partition. Tableau also has variations such as RANK_DENSE and RANK_UNIQUE, which handle ties differently.
  • Relative positions: LOOKUP(SUM([Sales]), -1) returns the expression’s value one addressed mark before the current mark. A positive offset looks ahead; zero refers to the current mark. INDEX() returns a mark’s position in the partition, while FIRST() and LAST() return offsets from its ends.
  • Window calculations: WINDOW_AVG(SUM([Sales]), -2, 0) averages the current mark and the two preceding marks. The optional start and end offsets define the window relative to the current position. Functions such as WINDOW_SUM, WINDOW_MIN, and WINDOW_MAX apply other aggregations over a window.
  • Previous-result calculations: PREVIOUS_VALUE refers to the result of the calculation at the previous mark. It is useful for recursive calculations, but is not interchangeable with LOOKUP, which retrieves a value of an expression at a specified offset.

Function names describe the operation, but they do not by themselves determine which marks are included. For instance, a window average with a three-mark frame is not necessarily a three-month average: it is a three-mark average, and the marks might represent weeks, products, or another dimension.

Quick table calculations and custom fields

For common tasks, Tableau offers quick table calculations that configure a table calculation on a measure in the view. Right-click or open the menu on the measure pill, choose Quick Table Calculation, and select an option such as Running Total, Difference, Percent of Total, Rank, or Moving Average. The available options depend on the field and view. A quick calculation is a convenient starting point, not a separate kind of data.

To inspect or adjust its direction, use the measure pill’s menu and choose Edit Table Calculation. For more control, create a calculated field with a table calculation function, then place that field in the view and set its computation. A custom field is useful when the quick calculation does not express the desired operation, such as a moving average over a particular number of marks or a difference from a mark several positions earlier.

For a month-to-month sales change, for example, a calculated field can subtract the prior mark’s sales from the current mark’s sales using SUM([Sales]) - LOOKUP(SUM([Sales]), -1). The first month in each partition has no prior mark, so its result is typically Null. Whether that should display as blank, be replaced, or be excluded is a reporting choice; do not interpret the missing comparison as a sales value of zero.

Addressing, partitioning, and calculation direction

When configuring a calculation, Tableau offers ways to choose how it moves through the view. Options such as Table Across and Table Down follow the layout of the worksheet. Pane options limit the calculation to a pane, which is a section formed by the dimensions in the view. These choices can be fast to use, but they may be fragile if the layout changes.

Specific Dimensions gives more direct control. In its list, dimensions selected for the calculation are addressing dimensions: Tableau moves through their values. Dimensions left unselected are partitioning dimensions: Tableau divides the marks into groups and restarts the calculation for each group. The precise result still depends on the view’s marks and sorting.

To configure a running monthly total separately by region, select Month as the addressing dimension and leave Region as a partitioning dimension. Verify that months are sorted chronologically, not alphabetically, and check that each region begins again at the intended starting point. The same test is useful for ranks: identify the group being ranked, then confirm whether the rank should restart within each group.

A good way to validate settings is to temporarily add the relevant dimensions to the view, display the underlying marks in a text table, and compare the calculation with a small hand-checkable example. Then remove any diagnostic fields and confirm the result still matches the intended question.

Choosing between table calculations and other calculations

Choose a table calculation when the answer depends on the order or neighborhood of marks in a view—for example, a running total by month, a rank of products within category, or a moving average over recent periods. It is often a natural fit for visual comparisons because its scope can follow the dimensions displayed in the worksheet.

Use a regular aggregate such as SUM([Sales]) when the goal is simply to aggregate records into a mark, without comparing that mark to others. Consider a level of detail (LOD) expression when a calculation needs to be evaluated at a specified data granularity that should not change merely because a dimension is added to or removed from the view. LOD expressions and table calculations solve different problems: an LOD sets a level of detail for aggregation, while a table calculation works over marks after the view’s results have been formed.

This distinction matters in dashboards. A table calculation may change when a user filters or rearranges the view because the set or order of marks changes. If a metric must retain a fixed denominator or a defined data-level population, test whether an LOD expression or another modeling approach better matches that requirement.

Filters, sorting, and common problems

Table calculations are evaluated late in Tableau’s order of operations, after many data and view operations. Consequently, filters that remove data or marks can change the values available to a calculation. A table-calculation filter is a special case: it can hide marks based on a table-calculation result while allowing the calculation to be computed over the broader set of marks. This is useful for showing, for example, the top-ranked items without necessarily recalculating ranks only among the items left visible. The exact effect depends on the filter type and worksheet setup.

Sorting is another frequent source of surprising results. A running sum follows the addressing order, and a rank uses the values and partition in its calculation. If months sort alphabetically, or a rank is computed across the wrong dimension, the output can be mathematically consistent but answer the wrong question. Set and inspect the sort order rather than assuming the displayed order is chronological or meaningful.

When a result looks wrong, check these issues in order:

  • Confirm which dimensions are in the view and what each mark represents.
  • Open Edit Table Calculation and inspect the addressing and partitioning settings.
  • Check the sort order, especially for dates and sequential categories.
  • Review filters and determine whether they remove marks before the calculation or hide results afterward.
  • Look for Null values, ties, and partitions with too few marks for the chosen window.

A common misconception is that a table calculation is always a calculation over rows in the data source. It is not: it works over the view’s marks. Another is that changing the formula will fix a wrong direction. Often the formula is correct and the computation settings need adjustment.

Frequently Asked Questions

Are table calculations the same as table functions in Tableau?

People often use the terms interchangeably. Tableau’s functions for these expressions are commonly called table calculation functions, and a table calculation is the resulting computation applied across marks in a view.

How do I create a running total in Tableau?

Right-click the measure pill and choose Quick Table Calculation > Running Total. Then use Edit Table Calculation to confirm the direction, partitioning, and order are appropriate for the view.

Why does my table calculation change when I add a dimension?

Adding a dimension can split marks into more detailed groups or change the calculation’s addressing and partitioning. Since table calculations operate over marks in the view, review the computation settings whenever the view’s structure changes.

What is the difference between LOOKUP and PREVIOUS_VALUE?

LOOKUP retrieves the value of an expression at a relative mark position, such as the previous mark. PREVIOUS_VALUE uses the prior mark’s result of the calculation itself, which makes it useful for recursive patterns.

Can a table calculation work without a table or text table?

Yes. The word table does not mean the worksheet must be a text table. Table calculations can be used in charts and other views; they still operate on the marks defined by the dimensions and measures in that visualization.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.