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
Anonymous
Not applicable

Running Total between two dates

Hi All,

 

I have a running total calculated for use on a bar/line combo chart using the built-in running total quick measure on my revenue column of a table. I have a relationship active between my revenue table and a dedicated Date table. The problem I'm having is, my Financial year runs from October 1st - September 30th, and therefore only have revenue finalised up until a certain point. When I calculate the running total, the calculation stops where the revenue finishes in the data and leaves a horizontal line on my line chart with the current total. How do I only calculate up until a certain point, or between two dates to prevent this happening, as the outcome is very messy. I've highligted the outcome below:

 

Capture.PNG

My current measure's DAX is as follows:

 

REVENUE CM running total in Date =
CALCULATE(
    SUM('Actuals'[REVENUE CM]),
    FILTER(
        ALLSELECTED('FY Calendar'[Date]),
        ISONORAFTER('FY Calendar'[Date], MAX('FY Calendar'[Date]), DESC)
    )
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

 

REVENUE CM running total in Date =

var _max = maxx(allselected('Actuals'), 'Actuals'[Date])

return
CALCULATE(
SUM('Actuals'[REVENUE CM]),
FILTER(
ALLSELECTED('FY Calendar'[Date]),
ISONORAFTER('FY Calendar'[Date], MAX('FY Calendar'[Date]), DESC) && 'FY Calendar'[Date] <= _max
)
)

 

or

 

REVENUE CM running total in Date =

var _max = maxx(allselected('Actuals'), 'Actuals'[Date])

return if( max( 'FY Calendar'[Date]) <= _max 
CALCULATE(
SUM('Actuals'[REVENUE CM]),
FILTER(
ALLSELECTED('FY Calendar'[Date]),
ISONORAFTER('FY Calendar'[Date], MAX('FY Calendar'[Date]), DESC)
)
), blank())

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

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

 

REVENUE CM running total in Date =

var _max = maxx(allselected('Actuals'), 'Actuals'[Date])

return
CALCULATE(
SUM('Actuals'[REVENUE CM]),
FILTER(
ALLSELECTED('FY Calendar'[Date]),
ISONORAFTER('FY Calendar'[Date], MAX('FY Calendar'[Date]), DESC) && 'FY Calendar'[Date] <= _max
)
)

 

or

 

REVENUE CM running total in Date =

var _max = maxx(allselected('Actuals'), 'Actuals'[Date])

return if( max( 'FY Calendar'[Date]) <= _max 
CALCULATE(
SUM('Actuals'[REVENUE CM]),
FILTER(
ALLSELECTED('FY Calendar'[Date]),
ISONORAFTER('FY Calendar'[Date], MAX('FY Calendar'[Date]), DESC)
)
), blank())

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
Anonymous
Not applicable

Superb - second one worked perfectly, just had to add in a comma after _max in the if statement.

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.