View the original community article here
Last tested: April 2021
How do I use window functions in Looker?
Window functions are a very powerful tool in SQL because they perform post-aggregation calculations. There are two main ways to implement window functions in Looker:
1: Use Table Calculations
Calculating after aggregations is exactly what table calculations excel at. Many common window functions in SQL can be replaced by table calcs like row
, offset
, or clever combinations thereof. Do keep in mind though, table calculations can only be performed on the data within the Data Tab of the Explore page!
2: Use a derived table
If table calculations don't provide what you need, you can always write a derived table with whatever SQL you want, including window functions.
This content is subject to limited support.