Rolling 3-month sales vs. budget with DATESINPERIOD
Compare the last three months of sales with the same three months of budget, a smoother variance than a single month.
You will learn to
- Build a rolling date window once and reuse it
- Apply the same window to actuals and budget
- Report a rolling variance as a percentage
How it works
Monthly variance to budget jumps around: one slow month looks alarming, one big order looks like a turnaround. A **rolling three months** view smooths that out by comparing the last three months of sales with the same three months of budget.
`DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, MONTH)` returns the dates of the three months ending on the last visible date. Store it in a variable and use it as a filter twice: once for `[Total Sales]` and once for `[Total Budget]`, so both cover exactly the same window.
Then the variance is (sales โ budget) รท budget. In the first months of the data the window is shorter, but sales and budget are cut the same way, so the comparison stays fair.
Practice it hands-on with a real data model and a live report that updates as you type.
Rolling 3M Quantity =
VAR window = DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, MONTH)
RETURN CALCULATE([Total Quantity], window)