Forum Discussion
RemoveFilters not working as expected
Hi astano05
Given your scenario, where you have a page-level filter for “DaysAgo > 0” and you're attempting to calculate “Net Sales PrevMonth” for the full previous month, your approach seems logically sound.
The issue might stem from how the filter context is passed down or from the specific interactions between your measures and the data model.
You might try the following:
Verify relationships: Make sure the relationships between the Calendar table and other related tables in the data model are set up correctly.
If "REMOVEFILTERS" does not provide the expected results, consider using an alternative to explicitly define the calculated date range.
For example, you can use the combination of "FILTER" and "ALL" to redefine the context of a calculation:
Last month’s net sales =
calculate(
sum('yourTable'[Net Sales MTD]),
filter(
all('calendar'),
'Calendar'[date value] > EOMONTH(TODAY(), -2)
&& 'Calendar'[date value] <= EOMONTH(TODAY(), -1)
)
)
This metric explicitly sets the date range to the entire month of the previous month, regardless of current day or any page-level filters.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I was actually able to get my measure working by using ParallelPeriod in place of DateAdd. The RemoveFilters context was no longer needed with that.
Thank you