Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
klod78
Frequent Visitor

Running Total

I am trying to calculate the running total, but it is not working as I want. If you look at the pictures below, it works if I don't apply any filter, but if for instance I want to see the data for 2018, I would expect to see under running total in february 2018 the number 3 and in correspondence of march 2018 the number 4...the sum of february and march...but I see always the number 8 and 9...what is wrong? the formula I used is:

Running total =
CALCULATE (
SUM('Sheet1 (2)'[Count]);
FILTER(
ALL('Sheet1 (2)' );
'Sheet1 (2)'[IntrDate] <= MAX('Sheet1 (2)'[IntrDate])
)
)
fig1.JPGfig2.JPG

 

2 ACCEPTED SOLUTIONS
danielkrol
Helper II
Helper II

amitchandak
Super User
Super User

@klod78 , Try like

Running total =
CALCULATE (
SUM('Sheet1 (2)'[Count]);
FILTER(
ALLselected('Sheet1 (2)' );
'Sheet1 (2)'[IntrDate] <= MAX('Sheet1 (2)'[IntrDate])
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@klod78 , Try like

Running total =
CALCULATE (
SUM('Sheet1 (2)'[Count]);
FILTER(
ALLselected('Sheet1 (2)' );
'Sheet1 (2)'[IntrDate] <= MAX('Sheet1 (2)'[IntrDate])
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AntrikshSharma
Super User
Super User

Here is a running total pattern:

 

Running Total = 
VAR MaxDateInFilterContext =
    MAX ( Dates[Date] )
VAR MaxYear =
    YEAR ( MaxDateInFilterContext )
VAR DatesLessThanMaxDate =
    FILTER (
        ALL ( Dates ),
        Dates[Date] <= MaxDateInFilterContext
            && Dates[Calendar Year Number] = MaxYear
    )
VAR Result =
    CALCULATE (
        [Total Sales],
        DatesLessThanMaxDate
    )
RETURN
    Result

 

danielkrol
Helper II
Helper II

My guess would be to use ALLSELECTED, instead of ALL https://docs.microsoft.com/nl-nl/dax/allselected-function-dax

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.