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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Filtering Running Total

Hi there,

I'm facing some trouble here when trying to insert a filtering condition for a Running Total of cumulative sales.

Althought the running total without filter runs perfectly, when I try to put a filter into the sentence it stops showing a "growth" line and starts showing a line that goes up and down

 

My Running Total, one which is running perfectly is:

 
 
M Sales SUM running total over Date =
CALCULATE(
SUM('Sales'[Value]);
FILTER( ALLSELECTED('Sales'); 'Sales'[Date] <= MAX ( 'Sales'[Date] ) ))
 
 
 
My objective now is being able to run a DAX like this, and still showing in my chart a running total growing line:
 
 

M Filtered Sales SUM running total over Date =
CALCULATE(
SUM('Sales'[Value]);
FILTER('Sales';'Sales'[Country]="Brazil");
FILTER( ALLSELECTED('Sales'); 'Sales'[Date] <= MAX ( 'Sales'[Date] ) ))

 

 

 

 

Can you help me ?

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Try this measure instead.  Filtering the whole Sales table is affected your filters more than you intended.  Note that I changed your ALLSELECTED() part too.  If this doesn't work, you can change it back to ALLSELECTED('Sales').  I don't know your model, so could be either way.

 

M Filtered Sales SUM running total over Date =
CALCULATE(
SUM('Sales'[Value]);
'Sales'[Country]="Brazil";
FILTER( ALLSELECTED('Sales'[Date]); 'Sales'[Date] <= MAX ( 'Sales'[Date] ) ))

 

If this solution works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem solved?

 

 

Best Regards,

Icey

amitchandak
Super User
Super User

@Anonymous , Try like


CALCULATE(
SUM('Sales'[Value]);
FILTER( ALLSELECTED('Sales'); 'Sales'[Date] <= MAX ( 'Sales'[Date] ) && 'Sales'[Country]="Brazil"))

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 As a best practice, add date dimension in your model and use it for and time intelligence calculations. There are many posts on how to add date dimension and below is the link to a few. Once the date dimension is added, mark it as a date table on table tools.

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-1-calendar-columns

 

Add following measure and it will work more efficient on large datasets

 

SUM('Sales'[Value]);
FILTER( ALLSELECTED('CalendarTable'[Date]); 'CalendarTable'[Date] <= MAX ( 'CalendarTable'[Date] ) ),
'Sales'[Country]="Brazil"
)

Let's try to follow the best practice for scalable solutionsI would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mahoneypat
Microsoft Employee
Microsoft Employee

Try this measure instead.  Filtering the whole Sales table is affected your filters more than you intended.  Note that I changed your ALLSELECTED() part too.  If this doesn't work, you can change it back to ALLSELECTED('Sales').  I don't know your model, so could be either way.

 

M Filtered Sales SUM running total over Date =
CALCULATE(
SUM('Sales'[Value]);
'Sales'[Country]="Brazil";
FILTER( ALLSELECTED('Sales'[Date]); 'Sales'[Date] <= MAX ( 'Sales'[Date] ) ))

 

If this solution works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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