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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
michaelshparber
Advocate V
Advocate V

Running Total with FILTER on a Fact Table not working

Hello friends,

***Edited***********

I think I've solved it.

This calculation is WRONG:

Running Sales Apples = CALCULATE([Running Sales],FILTER(Sales,Sales[Product]="Apples"))

And this one is right:

Running Sales Apples = CALCULATE([Running Sales],Sales[Product]="Apples")

So without FILTER() it is working.

Can anyone explain it, please?

********************

I have a simple Sales Fact Table and a Calendar table.

I have a Running Sales Amt which is working fine.

Running Sales = CALCULATE(Sales[Sales],FILTER(ALL('Calendar'),'Calendar'[Date]<=MAX('Calendar'[Date])))
When I add a Running Total measure that is filtered on a certain Product from the Fact table, like this:
Running Sales Apples = CALCULATE([Running Sales],filter(Sales,Sales[Product]="Apples"))
then I get wrong results - it doesn't sum up all the months...
Running.JPG
In my real-world scenario I cannot create a "Product" dimension so I need to filter the fact table.
 
How do I do it?
Thanks!
 
Here is a sample file:
 
9 REPLIES 9
v-yuta-msft
Community Support
Community Support

@michaelshparber ,

 

They are different on dax engine. The similar thread in stackoverflow below and two blogs may help you understand the difference:

https://stackoverflow.com/questions/50506030/dax-calculate-function-with-and-without-filter

 

Blogs:

https://www.red-gate.com/simple-talk/sql/bi/using-the-filter-function-in-dax/

https://exceleratorbi.com.au/the-filter-function-in-dax/

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yuta-msft 

Thanks, I've looked at all of the articles.

Nowhere could I find the answer - why doesn't my Running Total work?

I did include ALL(Calendar) - and it is working until I do FILTER(Sales,...)

Please help to understand

Thank you

michaelshparber
Advocate V
Advocate V

I think I solved it.

This calculation is WRONG:

Running Sales Apples = CALCULATE([Running Sales],FILTER(Sales,Sales[Product]="Apples"))

And this one is right:

Running Sales Apples = CALCULATE([Running Sales],Sales[Product]="Apples")

So without FILTER() it is working.

Can anyone explain it, please?

FrankAT
Community Champion
Community Champion

Hi @michaelshparber ,

see figure:

 

09-04-_2020_22-27-37.png

 

Regards FrankAT

Thanks @FrankAT 

I am looking for a solution to calculate for a specific product, such as Apples

 

Hi @michaelshparber ,

it's all insight:

 

09-04-_2020_23-19-17.png

Regards FrankAT

Sorry, @FrankAT 

ALLEXCEPT doesn't fit because there are other fields in Fact table that can be drillable.

The solution is on the surface, why the plain FILTER is not working?

 

Greg_Deckler
Community Champion
Community Champion

Hmm, well, see attached and let me know what you think:

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler thanks, but SUMX is not the solution I am looking for.

Because of ALL(Sales) - I cannot drill down to details....

When there are other fields in the Sales table - your measure will return same amount for all of them.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors