Forum

How to Calculate Ru...
 
Share:
Notifications
Clear all

How to Calculate Running Total in Power BI Using DAX

1 Posts
1 Users
0 Reactions
1,291 Views
Posts: 134
Admin
Topic starter
(@sql-admin)
Reputable Member
Joined: 6 years ago

How to Calculate Running Total in Power BI Using DAX

Calculating a running total (cumulative total) is one of the most commonly used metrics in Power BI dashboards, especially in sales analysis, revenue tracking, and performance trends. Power BI makes this easy using DAX (Data Analysis Expressions).


What Is a Running Total in Power BI?

A running total is the sum of values that accumulates over a period. For example, in a sales table, instead of seeing daily sales in isolation, a running total shows progressive sales till that date.

This is useful for:

  • Monthly or daily revenue trends

  • Year-to-date (YTD) performance

  • Comparing progressive targets vs achievements


Creating a Running Total Using DAX

Assume you have a table called Sales with these columns:

  • Date

  • Amount

Step-by-step formula to create a running total measure:

Running Total = 
CALCULATE(
    SUM(Sales[Amount]),
    FILTER(
        ALLSELECTED(Sales[Date]),
        Sales[Date] <= MAX(Sales[Date])
    )
)

Explanation:

  • CALCULATE() changes the context of calculation.

  • SUM(Sales[Amount]) adds up the values.

  • FILTER() defines a condition that includes all dates less than or equal to the current row.

  • ALLSELECTED() respects filters from slicers or visuals.


Where to Use This Measure

  • Add it to line or area charts for cumulative sales trend.

  • Use it in tables alongside daily values to show progressive totals.

  • Combine with MONTH() or YEAR() columns for monthly/yearly totals.


Alternate: Running Total in a Calculated Column

If you need a column instead of a measure:

RunningTotalColumn = 
CALCULATE(
    SUM(Sales[Amount]),
    FILTER(
        Sales,
        Sales[Date] <= EARLIER(Sales[Date])
    )
)

Use this when you're building logic row-by-row (less common in visuals).


Common Mistakes to Avoid

  • Using ALL() instead of ALLSELECTED() — this ignores slicers.

  • Not ordering dates properly in visuals — running totals won’t show correctly.

  • Applying running total on non-date columns — always link it to a proper Date dimension table.


Bonus Tip: Running Total by Month or Year

To calculate cumulative sales by month:

Running Total Monthly = 
CALCULATE(
    SUM(Sales[Amount]),
    FILTER(
        ALLSELECTED(Sales),
        Sales[Month] <= MAX(Sales[Month])
    )
)

Make sure Month is in a proper format like MMM YYYY.

 


Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: