Running total that restarts every year with FILTER and ALL
Make a cumulative total reset each January by adding a year condition to the FILTER, and see it side by side with a running total that never resets.
You will learn to
- Reset a running total at a boundary with a second condition
- Capture values from the row with VAR before FILTER runs
- Read a Year → Month matrix with subtotals
How it works
Often you want a running total that **starts over** every year: January 2025 should begin from zero, not carry all of 2024 with it. With the FILTER pattern that just means one more condition: keep the dates up to the end of the row **and** in the same year as the row.
Capture both values from the row first with variables:
- `VAR LastDay = MAX('Date'[Date])`, the end of the row. - `VAR ThisYear = MAX('Date'[Year])`, the row’s year.
Then filter `ALL('Date')` (the whole table, so the Year column is there to test) with both conditions joined by `&&`.
`DATESYTD` gives the same numbers for a calendar year, so why learn this? Because the pattern bends: swap the year condition for a quarter, a season or a custom period column and it restarts wherever you need it.
Practice it hands-on with a real data model and a live report that updates as you type.
Units Month So Far = VAR LastDay = MAX('Date'[Date]) VAR ThisMonth = MAX('Date'[YearMonth]) RETURN CALCULATE([Total Quantity], FILTER(ALL('Date'), 'Date'[Date] <= LastDay && 'Date'[YearMonth] = ThisMonth))