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
mmanwaring
Resolver I
Resolver I

Filter context breaking my calculation

Hi All,

Hope someone can shed some light on my problem.

I have a stock movement calculation which is pivoted by col = sku and row= year.
The problem is that the table has to be filtered to the correct movement types.

example.
This works for running total:

CALCULATE(SUM('Table'[TrueQuantity]), DimDates[Date] <= MaxDate , ALL(DimDates) )

 

1.png

this does not:

CALCULATE(SUM(MovementsInOut[TrueQuantity]), FILTER( MovementsInOut , movementsInOut[movementtype] IN {100,392,227,235,225}), DimDates[Date] <= MaxDate , ALL(DimDates) )


2.png

I would like to avoid creating an additional table to the model so if the filter can work within the calculation that would be perfect

thank you

Mike

7 REPLIES 7
amitchandak
Super User
Super User

@mmanwaring , Try like

CALCULATE(SUM(MovementsInOut[TrueQuantity]), FILTER( MovementsInOut , movementsInOut[movementtype] IN {100,392,227,235,225}), filter(all(DimDates) ,DimDates[Date] <= MaxDate ))

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

Hi, Thank you for your reply.
It does however not change the results.
Mike

@mmanwaring ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Hi amitchandak

 

----


Thank you Mike

@mmanwaring , No access, applied for it

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

Hi

The measure works fine until i add the filter for the movement types then it breaks. It will be ok if i make a new table but not if i calculate a new table within the measure?

Thanks Mike

Hello

Sorry try now  sample 

 

thank you

Mike

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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