Running count of orders that respects the slicer with ALLSELECTED
Count orders cumulatively from the first date the report user selected, using ALLSELECTED instead of ALL so a Year slicer still applies.
You will learn to
- Explain the difference between ALL and ALLSELECTED
- Build a running count that starts at the slicer selection
- Test a measure under several slicer selections
How it works
The running-total pattern uses `ALL('Date'[Date])` so it can reach back to earlier dates. But `ALL` removes **every** filter on dates, including the ones the report user chose in a slicer. Pick 2025 in a Year slicer and the running count still starts from 2024’s orders, which is rarely what the reader expects.
`ALLSELECTED` is the polite version. It removes the filters that come from the visual itself (the row you are on) but **keeps the slicer selection**. With 2025 selected, `ALLSELECTED('Date'[Date])` is every date of 2025; with both years selected it is both years.
So the running count starts from the first selected date. Swap one word in the familiar pattern and the measure follows the report page.
Practice it hands-on with a real data model and a live report that updates as you type.
Selected Running Sales = CALCULATE([Total Sales], FILTER(ALLSELECTED('Date'[Date]), 'Date'[Date] <= MAX('Date'[Date])))