Streak 0 daysPoints 0

Lesson38/59
Moving windows

Rolling three months with DATESINPERIOD

New functionsCALCULATE, DATESINPERIOD, MAX
StatusNot started

A rolling total looks back a fixed window from the end of the cell. DATESINPERIOD(Date[Date], MAX(Date[Date]), -3, MONTH) returns the three months that end on the cell’s last date.

In March that is January to March; in January it reaches back into November and December of the year before.

Your task

Write Sales 3M: the Sales Amount of the three months ending with the cell’s month.

*1*1*1*1SALEST1 · 420 ROWSSalesKeyNUMOrder DateDATEShip DateDATEProductKeyNUMCustomerKeyNUMQuantityNUMUnit PriceNUMPRODUCTT2 · 8 ROWSProductKeyNUMProductTEXTCategoryTEXTColorTEXTList PriceNUMStandard CostNUMCUSTOMERT3 · 10 ROWSCustomerKeyNUMCustomerTEXTCountryTEXTSegmentTEXTDATET4 · 731 ROWSDateDATEYearNUMQuarterTEXTMonthTEXTMonth NumberNUMNOTES1Filters flow from 1 to *, alongthe arrow: Product filters Sales.2Select a column or a measureto insert it at the cursor.3Measures in this model:[Sales Amount]Key columnFact tableSALES MODEL · STAR SCHEMASHEET 1 OF 1

About this exercise

You practise moving windows with CALCULATE, DATESINPERIOD and MAX. The exercise runs on a small bike-shop model with a Sales fact table and Product, Customer and Date dimensions, the same star schema in every lesson.

Your measure, Sales 3M, fills a Power BI-style matrix grouped by Date[Month]. As in a real report, each cell evaluates the measure in its own filter context, and the subtotals and the grand total are evaluated again in theirs rather than added up. When you check your answer, every cell is compared with the expected value, wrong cells are marked, and the hint is about the mistake you made.

Measures that already exist in the model: Sales Amount. Reference them in square brackets, for example [Sales Amount].

Where you start

Sales 3M =

The result to build

Slicer: Year is 2025

Expected result for Sales 3M
MonthSales 3M
Jan31,672.00
Feb36,061.60
Mar34,747.45
Apr25,189.60
May30,366.20
Jun25,115.10
Jul30,505.30
Aug25,015.65
Sep29,587.65
Oct25,937.45
Nov39,453.40
Dec40,286.10
Total40,286.10

Last updated 10 November 2026

Opening the exercise…