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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Gokul_Saraboji
Helper II
Helper II

How to Create a Dynamic Running Total in DAX That Responds to Slicers and Filters

Hi Power BI Community,

I am trying to create a running total measure in DAX that updates dynamically based on filters applied in the report - like Date, Product Category, or Region.

I have tried using TOTALYTD and CALCULATE with FILTER , but the results are not  accurate when slicers are used. The running total doesn’t always reflect the filtered data correctly.

Am looking for a DAX formula that:

  • Calculates a running total

  • Works with all slicers and filters

  • Updates based on the selected date range or other fields

Any help or examples would be greatly appreciated!

Thanks in Advance!

1 ACCEPTED SOLUTION
Abhilash_P
Responsive Resident
Responsive Resident

Hi @Gokul_Saraboji 

You can create a dynamic running total using CALCULATE, SUM, and a date filter condition like this:

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

 



Thanks

View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@Gokul_Saraboji 

you can also try to use new visual calculation to get running total

https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview?wt.m...

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Abhilash_P
Responsive Resident
Responsive Resident

Hi @Gokul_Saraboji 

You can create a dynamic running total using CALCULATE, SUM, and a date filter condition like this:

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

 



Thanks

rajendraongole1
Super User
Super User

Hi @Gokul_Saraboji  - you can use the CALCULATE function along with FILTER and ALLSELECTED. 

 

eg: 

Running Total =
CALCULATE(
SUM('YourTable'[SalesAmount]), -- replace with your measure/column
FILTER(
ALLSELECTED('YourDateTable'[Date]), -- respects slicers
'YourDateTable'[Date] <= MAX('YourDateTable'[Date])
)
)

 

try the above logic and replace with your table as per model. Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





burakkaragoz
Community Champion
Community Champion

Hi @Gokul_Saraboji ,

I get what you mean about the running total not updating correctly with slicers or filters, that’s a pretty common DAX headache. When you want a running total that’s fully dynamic and respects all the slicers and filters, you usually wanna avoid TOTALYTD unless it’s a simple date scenario.

Try using something like this instead (assuming you have a Date table connected properly):

Code
 
Running Total = 
CALCULATE(
    SUM('YourTable'[YourValue]),
    FILTER(
        ALLSELECTED('YourTable'[DateColumn]),
        'YourTable'[DateColumn] <= MAX('YourTable'[DateColumn])
    )
)

This formula sums up your [YourValue] column up to the max date in the current filter context, which means it should respect whatever slicers or filters the user applies (date range, product, whatever). Just make sure your Date table is marked as a Date Table and relationships are set up correctly.

If you want to get even more flexible, swap 'YourTable'[DateColumn] with your actual date field and 'YourTable'[YourValue] with the field you want to total.

Let me know if you run into any issues or need a tweak for your specific scenario!

If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.