Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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!
Solved! Go to Solution.
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
you can also try to use new visual calculation to get running total
Proud to be a Super User!
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
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.
Proud to be a Super User! | |
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):
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.
User | Count |
---|---|
84 | |
78 | |
70 | |
47 | |
41 |
User | Count |
---|---|
108 | |
53 | |
50 | |
40 | |
40 |