Insights Power BI Cumulative Sum: Calculate Period-to-Period Change with DAX

Power BI Cumulative Sum: Calculate Period-to-Period Change with DAX

What Is a Power BI Cumulative Sum?

A cumulative sum, sometimes called a running total, adds up values across time incrementally — each period’s total reflects everything up to and including that point, rather than just that period on its own. In Power BI, this is typically built using DAX measures that accumulate a value (like sales or revenue) as you move through your date table.

Cumulative sums become even more useful when paired with period-to-period change — the month-over-month or year-over-year difference in that running total. Together, they let analysts see not just where a number stands, but whether performance is accelerating or slowing down over time. This combination is one of the most common DAX patterns in sales and financial reporting, which is exactly what the rest of this post walks through.

Step 1: Create the Sum Measure

To first understand period to period change, you want to start by creating an expression in DAX (a library of functions and operators that can build formulas and expressions in Power BI Desktop) that calculates the sum of sales. You can do this by writing a measure like the following:

Sum = SUM(‘Internet Sales'[Sales Amount])

Step 2: Create the Period-to-Period Difference Measure

Next you want to create a measure called “Difference” representing the change in sales each month for one year. To calculate this, we take the sum of sales for the current year and subtract the sum of sales from the previous year. To calculate the sum of sales from the previous year, we want to use three functions: CALCULATE, SUM and DATEADD. This sums the sales, specifies which dates to use, and the interval (-1 represents the previous year, likewise, -2 represents the previous two years).

Difference = [Sum]- CALCULATE(SUM(‘Internet Sales'[Sales Amount]), DATEADD(‘Date'[Date], -1, YEAR))

Step 3: Calculate the Running Cumulative Sum

Now that we have the Sum and Difference measures, we just need to calculate the cumulative sum. This is where it can be a little tricky. We start by declaring our _mnth variable. The VAR keyword introduces the definition of a variable. You can have as many variables as needed in a single expression, and each one has its own VAR definition. The RETURN keyword defines the expression to return. Inside the RETURN expression, you can use the variables, which are replaced by the computed value. We use the SUMX function and the VALUES function to signify that a table is going to be returned. We specifically want to sum our Difference measure each month. Next, the ALL function clears filters from our months. Lastly, we check to see if the months that we are summing come prior to the current date. The following code further creates the graph below.

Cumulative Sum =

VAR _mnth = SELECTEDVALUE(‘Date'[Month])

RETURN

 CALCULATE (

    SUMX (VALUES(‘Date'[Month]), [Difference])

    ,ALL(‘Date'[Month])

  , ‘date'[Month] <= _mnth

    )

With Sum, Difference, and Cumulative Sum now added to your model, it’s worth thinking about how you’ll track these measures as your report grows — check out our guide on using DAX Studio to jump-start your data dictionary to catalog what each measure does before your model gets too big to manage.

Power BI DAX Consulting from Concurrency

Cumulative sums and period-to-period change are just one pattern in a much larger DAX toolkit — getting them right (and keeping them performant as your model grows) is where experienced hands make the difference. If you’re looking for hands-on help, our Power BI consulting and reporting services can support everything from measure design to full dashboard builds.

Want to keep building out your dashboard? Check out our guides on adding dynamic monthly/yearly toggles to Power BI dashboards and building a polished Power BI dashboard UI.