# What is the Window function in Tableau? Tableau Functions

> This is content from just-tim, the data-and-analytics channel by Tim Ngwena (formerly 'Tableau Tim'). Tim has 12+ years of hands-on BI experience and covers Tableau most of all, plus Power BI, Looker, Hex, SQL and data modelling, the analytics industry, and the craft of doing the job — always tool-agnostic and honest about the trade-offs.

- **Author:** Tim Ngwena (just-tim, https://just-tim.com/about)
- **Published:** 2021-08-26
- **Format:** Video · 1905 min watch · transcript available
- **Topics:** Data visualisation, Analytics
- **Tools:** Tableau (calculated fields, table calculations, window functions)
- **Canonical:** https://just-tim.com/posts/what-is-the-window-function-in-tableau-tableau-functions
- **Watch:** https://www.youtube.com/watch?v=8IySMkx4n4I

I walk through how the window capability works in Tableau, using WINDOW_SUM on Superstore sales to show how a window aggregates values. I explain calculation direction, how first/last and numeric coordinates define the window, and finish with a sneak peek at how built-in table calculations secretly write window functions for you.

## Key takeaways

- The window in any WINDOW_ function is defined by coordinates at the end of the expression, where 0 is the current row, FIRST is the start and LAST is the end, and everything between is aggregated.
- The aggregation type (sum, average, etc.) is separate from the expression inside it — you can run WINDOW_AVG over a SUM([Sales]) for compound calculations.
- Direction settings like table across, table down and table across then down dramatically change which cells fall inside the window.
- Using pane across then down can force Tableau to scaffold data into empty cells, producing misleading results you almost never want.
- Built-in quick table calculations such as moving averages are just window functions Tableau writes for you, and you can drag them out to reuse as calculations.

## Chapters

- 0:00 Introduction to window functions
- 0:31 Setting up the table and data
- 2:47 Writing the WINDOW_SUM calculation
- 4:53 Default behaviour and direction
- 8:20 Changing direction with table down
- 9:46 Defining window size with first and last
- 14:30 Switching to window average
- 16:03 Reversing with first
- 18:37 Custom numeric offsets
- 21:09 Table across then down
- 25:20 The danger of pane across then down
- 27:40 Coordinate notation summary

Watch the full video, read the transcript and use chapter deep-links on the page: https://just-tim.com/posts/what-is-the-window-function-in-tableau-tableau-functions

---
just-tim — Data and analytics, with a point of view. · https://www.youtube.com/channel/UC7HYxRWmaNlJux-X7rNLZyw · https://twitter.com/TableauTim · https://www.linkedin.com/in/timngwena
