·

Power BI Running Total in DAX: Fix Months, Gaps and Resets

·

Power BI running total line chart that stops at the last sale

You build a running total. It works on dates. Then you put months on the axis and every row shows… just that month. Or the line chart has a hole. Or it runs flat into next year.

Short answer: a Power BI running total is CALCULATE ( [Sales Amount], REMOVEFILTERS ( 'Date' ), 'Date'[Date] <= MAX date ), always on a date table, never on the fact table date. Then you add one small fix for each case: future months, the selected period, and categories.

Let’s build it on my demo model.

1. The running total measure

Here is the measure I use as the base:

Sales Running Total =
VAR _MaxDate = MAX ( 'Date'[Date] )
RETURN
CALCULATE (
[Sales Amount],
REMOVEFILTERS ( 'Date' ),
'Date'[Date] <= _MaxDate
)

Read it like this:

  • _MaxDate is the last date of the current row. For the row “2024 Feb” that’s February 29, 2024.
  • REMOVEFILTERS ( 'Date' ) clears every filter on the date table: year, month, Year Month, all of them.
  • 'Date'[Date] <= _MaxDate brings back all dates up to the end of the current row.

Products, customers and sales reps keep their filters. Only the time travels.

Put 'Date'[Year Month], Sales Amount and Sales Running Total in a matrix:

  • 2024 Jan: Sales Amount $273,822, running total $273,822
  • 2024 Feb: $228,812, running total $502,634
  • 2024 Mar: $524,210, running total $1,026,844
  • 2024 Dec: $1,010,525, running total $7,271,595
  • 2025 Dec: $1,856,985, running total $19,370,310
Power BI running total measure by month in a matrix: Sales Amount and Sales Running Total, January 2024 to December 2025

2. “My running total shows only the monthly value”

This is the most common question on the forum. The measure looks fine, it works with dates, but with months it returns the month value.

The usual cause: the measure removes the filter from one column only, like ALL ( Sales[Order Date] ), while the visual uses another column (a Month name, or the month from the auto date hierarchy). That month filter is still there. So “all dates up to today” becomes “all dates up to today, but only in February”.

Two rules fix it:

  1. Use a date table ('Date') with a relationship to Sales[Order Date], and use its columns in visuals.
  2. Remove filters from the whole date table, not one column: REMOVEFILTERS ( 'Date' ).

If your 'Date' table is marked as a date table, Power BI already removes the other date filters when you filter 'Date'[Date]. I still write REMOVEFILTERS every time. It costs nothing and the measure doesn’t depend on a setting someone can switch off.

3. Stop the line at the last sale

My date table runs to December 31, 2026. Sales stop on October 31, 2026. On a line chart, the running total goes flat for November and December at $30,396,765. It looks like we sold nothing for two months.

Return blank after the last sale:

Sales Running Total (to Last Sale) =
VAR _LastSaleDate =
CALCULATE (
MAX ( Sales[Order Date] ),
REMOVEFILTERS ( 'Date' )
)
RETURN
IF (
MIN ( 'Date'[Date] ) <= _LastSaleDate,
[Sales Running Total]
)

Now the line ends in October 2026. No fake plateau.

Power BI running total line chart that stops at the last sale in October 2026 instead of running flat into November and December

4. Months without sales: no more gaps

The demo has a nice trap. Gaming laptops (the Raptor 15 and Raptor 17 X) had no sales in August 2025.

Filter the chart to Products[Subcategory] = "Gaming Laptops":

  • With 'Date'[Month Start] on the axis, August 2025 is there. The running total stays at $2,255,415, same as July. Correct.
  • With Sales[Order Date] on the axis, August 2025 doesn’t exist. There is no row in the fact table for it, so the chart jumps from July straight to September. Worse, it’s not a running total anymore: the axis doesn’t filter 'Date', so every point shows only the sales of that one day.

Another way to create the same hole is wrapping the measure in IF ( ISBLANK ( [Sales Amount] ), BLANK (), ... ). People do it to hide future months. Use the “last sale” check from step 3 instead. It hides the future and keeps the gaps filled.

Power BI running total with months without sales: date table axis stays flat in August 2025, fact table Order Date axis shows daily sales instead

5. Start from the selected period (or reset every year)

Sales Running Total ignores every filter on dates, including the slicer. Select 2025 in a Year slicer and January 2025 starts at $7,949,239, because it includes all of 2024.

Sometimes that’s exactly what you want (a balance). Often it’s not. For “running total inside what I selected”, use ALLSELECTED:

Sales Running Total (Selected Period) =
VAR _MaxDate = MAX ( 'Date'[Date] )
RETURN
CALCULATE (
[Sales Amount],
FILTER (
ALLSELECTED ( 'Date' ),
'Date'[Date] <= _MaxDate
)
)

ALLSELECTED ( 'Date' ) keeps the slicer (2025) and removes only the filter from the matrix row. With Year = 2025, January shows $677,644 and December shows $12,098,715, the total for 2025.

Want it to reset every year automatically, without a slicer? That’s year-to-date. The demo model already has it:

Sales YTD =
TOTALYTD (
[Sales Amount],
'Date'[Date]
)

December 2025 shows $12,098,715, and January 2026 starts again at $987,804.

6. Running total by category

Good news: there is nothing to add. Because the measure only touches 'Date', every product filter stays.

Put 'Date'[Year Month] on rows and Products[Category] on columns, Year slicer = 2025, and use Sales Running Total (Selected Period). Each category has its own running total. In December 2025, Laptops reach $4,285,700 and Services $3,333,033.

This is exactly where a forum formula breaks: FILTER ( ALLSELECTED ( Sales ), ... ) removes filters from the whole fact table, including the product. Every product then shows the same, grand running total. Clear the date table, not the fact table.

Power BI running total by category in a matrix, Year slicer set to 2025, each category accumulating from January

7. The no-DAX way: visual calculations

If you only need it in one visual, try a visual calculation. Select the visual, then Home > New visual calculation, and write:

Running sum = RUNNINGSUM ( [Sales Amount] )

Even faster: right-click the visual, New visual calculation > Running sum. One catch: a visual calculation only sees the fields that are already in the visual. If Sales Amount isn’t there, you can’t use it.

It’s quick, but it lives in that visual only. You can’t reuse it in another visual, and it’s not included when users export the data. For anything you need more than once, keep the measure.

Power BI right-click menu on a matrix: New visual calculation, Running sum template
Power BI RUNNINGSUM visual calculation next to the DAX running total measure, same values by month

Common mistakes

  • Removing the filter from one date column only. The month column still filters, so every row returns its own month. Remove filters from the whole 'Date' table.
  • Using the fact table date on the axis. Months with no sales disappear, and the measure stops adding up. Use the date table columns.
  • ALL or ALLSELECTED on the fact table. You lose the product (or customer) filter and every row gets the grand total.
  • Hiding blanks with IF ( ISBLANK ( [Sales Amount] ) ... ). It hides the future, but also every month without sales.

FAQ

How do I create a running total in Power BI?
Use CALCULATE ( [Measure], REMOVEFILTERS ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) with a date table, or the “Running total” quick measure.

Why does my running total show the same value as the monthly total?
A filter on another date column (usually the month) is still active. Remove filters from the whole date table and use date table columns in the visual.

How do I reset a running total every year?
Use TOTALYTD or CALCULATE ( [Measure], DATESYTD ( 'Date'[Date] ) ). For a fiscal year, add the year-end date, for example "6/30".

How do I make a running total respect the slicer?
Use FILTER ( ALLSELECTED ( 'Date' ), 'Date'[Date] <= _MaxDate ) instead of REMOVEFILTERS ( 'Date' ).

Wrap up

One measure, four small decisions: whole date table, stop at the last sale, all time or selected period, and leave the products alone.

Want the current running total as a big number on top of the page? Put Sales Running Total (to Last Sale) in the new Card visual: Where Is the Multi-row Card? How to Use the New Card Visual in Power BI.

This is one of the most viewed questions on the Fabric Community forum: Cumulative Total has 828K views.

Keep adding up. Just don’t let your months fall through the gaps!

Nemanja Andić, Power BI consultant and trainer

Nemanja Andić

Power BI consultant and trainer, Microsoft certified, Fabric Community Super User. I write about the problems I solve in real projects.

About me · LinkedIn