Show a rolling 12-month total only when the window is complete
Hide rolling totals for months that don’t yet have a full 12 months of history, using VAR, EOMONTH and IF, so nobody mistakes a ramp-up for growth.
You will learn to
- Find the first date of the calendar with CALCULATE and ALL
- Work out when a window becomes complete with EOMONTH
- Return blank instead of a misleading partial total
How it works
Through 2024, `[Sales R12M]` climbs every single month, not because the business grew, but because the window is still filling up: in May 2024 it only holds five months. A reader who sees that line will draw the wrong conclusion. The honest fix is to show **blank until the window is complete**.
The window is complete once the row ends on or after the last day of the **12th month** of data. Two variables get you there:
- `CALCULATE(MIN('Date'[Date]), ALL('Date'))` is the first date of the calendar, whatever the row. - `EOMONTH(date, n)` returns the last day of the month **n months after** the date. `EOMONTH(first, 0)` is the end of the first month, so the end of the twelfth month is `n = 11`.
Then `IF(LastDay >= …, [measure])` shows the measure only when the condition holds; an IF with no “else” returns blank.
Practice it hands-on with a real data model and a live report that updates as you type.
Sales R3M (complete) = VAR LastDay = MAX('Date'[Date]) VAR FirstDay = CALCULATE(MIN('Date'[Date]), ALL('Date')) RETURN IF(LastDay >= EOMONTH(FirstDay, 2), CALCULATE([Total Sales], DATESINPERIOD('Date'[Date], LastDay, -3, MONTH)))