Summary of WINDOW_SUM
WINDOW_SUM is a powerful table calculation in Tableau that allows users to sum values across a visible window of marks in the view. This feature is particularly useful when you need running or grouped totals based on the current layout of the visualization, rather than just relying on raw data rows.

Problem Definition: The Need for Contextual Totals
Analysts frequently require totals that depend on what is visible in a view. Common questions include:
- What is the total sales across the rows currently shown in the table?
- What is the sum of sales within each partition of a dashboard view?
- What is the total value across the current range of months, categories, or ranked items?
These inquiries differ from standard aggregations at the data source level. For instance, a standard `SUM([Sales])` returns one result for each grouping in the view. In contrast, WINDOW_SUM operates on the marks already laid out in the visualization.
Key Concept: How WINDOW_SUM Works
WINDOW_SUM takes the values already computed in the view and sums them across a window of marks. It is important to note that the window is not the entire table unless the view is configured that way. As a table calculation, WINDOW_SUM works after Tableau has built the marks in the visualization. This makes it ideal for view-aware totals, moving sums, percent of total logic, and other calculations that depend on the table’s shape.
Data Example: Understanding with a Simple Dataset
Consider the following dataset:
| OrderID | Month | Category | Sales |
|---|---|---|---|
| 1 | Jan | Furniture | 100 |
| 2 | Jan | Technology | 200 |
| 3 | Feb | Furniture | 150 |
| 4 | Feb | Technology | 50 |
| 5 | Mar | Furniture | 120 |
| 6 | Mar | Technology | 180 |
If the view shows Month on rows, Tableau may display sales by month as follows:
| Month | SUM(Sales) |
|---|---|
| Jan | 300 |
| Feb | 200 |
| Mar | 300 |
Now, suppose we want a total across all visible months in the table. The answer should remain consistent for every row:
| Month | SUM(Sales) | WINDOW_SUM |
|---|---|---|
| Jan | 300 | 800 |
| Feb | 200 | 800 |
| Mar | 300 | 800 |
The total is 800 because it sums all three monthly values in the current window.
Tool Implementation: How to Use WINDOW_SUM
In Tableau, WINDOW_SUM is implemented as a table calculation. The syntax is as follows:
WINDOW_SUM(expression, [start], [end])
For example:
WINDOW_SUM(SUM([Sales]))
The expression inside WINDOW_SUM is typically an aggregated measure, such as `SUM([Sales])`. This is because table calculations operate on the results already present in the view. The optional `[start]` and `[end]` arguments define the window relative to the current mark. If omitted, Tableau uses the default window settings for the table calculation.
Applied Example: Practical Use of WINDOW_SUM
Assume the view contains Month in rows and Sales as a measure. The calculation would be:
WINDOW_SUM(SUM([Sales]))
The result would be:
| Month | SUM(Sales) | WINDOW_SUM(SUM(Sales)) |
|---|---|---|
| Jan | 300 | 800 |
| Feb | 200 | 800 |
| Mar | 300 | 800 |
This demonstrates the sum of all visible month totals. If the calculation is configured as a running window, the result changes based on the window range. For example, a moving sum over the current row and previous row can produce:
| Month | SUM(Sales) | WINDOW_SUM over 2-row window |
|---|---|---|
| Jan | 300 | 300 |
| Feb | 200 | 500 |
| Mar | 300 | 500 |
In this case, the expression sums only the rows included in the window for each mark.
Why WINDOW_SUM Exists: Addressing Common Limitations
Tableau does not always calculate totals at the level the analyst desires. A regular aggregation, such as `SUM([Sales])`, is evaluated at the level of detail defined by the view. If the view contains Month, Tableau sums by Month. If it contains Month and Category, Tableau sums by both.
WINDOW_SUM exists to work after that first aggregation step, allowing analysts to reuse values from the visualization and calculate a sum across them. This is why it is commonly used for calculations that depend on table layout rather than raw row-level data.
Important Behavioral Details of WINDOW_SUM
As a table calculation, WINDOW_SUM’s behavior depends on the view. The result changes based on partitioning and addressing. If the table calculation is computed across Table Down, the window follows the vertical order of rows. If computed across Table Across, the window follows the horizontal order of columns. This is a common source of confusion.
Additionally, WINDOW_SUM does not ignore filters in the same way a level of detail expression might. It operates on the marks that remain in the view after Tableau applies the relevant filters and layout rules. If the view changes, the result can also change. This makes WINDOW_SUM ideal for visual totals but not suitable for fixed business totals that must remain stable regardless of how the view is sliced.
Another important point is that the argument is usually already aggregated. A common pattern is:
WINDOW_SUM(SUM([Sales]))
Not:
WINDOW_SUM([Sales])
The first version works with the aggregated values in the view, while the second often causes aggregation issues because table calculations expect the measure to be evaluated at the view level first. Additionally, WINDOW_SUM depends on sort order; if the marks are reordered, the window can change, which is crucial for moving totals, running sums, and rank-based calculations.
Real Usage Patterns for WINDOW_SUM
Common use cases for WINDOW_SUM include:
- Total across visible marks
- Running totals
- Moving sums
- Percent of window total
- Totals by partition
- Normalization across displayed categories
- Dashboard metrics that depend on the current table layout
Example scenarios include:
- A sales manager wanting total revenue across the months currently shown in a chart.
- An analyst comparing each category against the sum of categories in the current panel.
- A dashboard needing a moving total over the last three periods.
- A migration team needing to understand why a Tableau total changes when the view changes.
Practical Interpretation of WINDOW_SUM
Think of WINDOW_SUM as a visual-layer total. It does not summarize the base table in isolation; rather, it summarizes the values Tableau has already placed into the visualization. This makes it powerful for dashboard logic but sensitive to view structure. If you need a total that remains fixed regardless of how the view is built, a level of detail expression is usually the better fit. Conversely, if you need a total that responds to the current marks in the table, WINDOW_SUM is the right tool.
Important Notes on WINDOW_SUM
- WINDOW_SUM is evaluated after the view is built.
- It is sensitive to partitioning, addressing, and sort order.
- It usually wraps an aggregated measure such as `
SUM([Sales])`. - It is best used for visual totals and table-based calculations.
- It is not the same as a fixed total at the data model level.