The window modifier is used commonly in Tableau to calculate totals, moving averages and sums and a range of other use cases. In this video, I walk through how windows work in Tableau in this first part of the explainer.
The window is defined as offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If start and end are omitted, the entire partition is used.