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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
astano05
Helper III
Helper III

RemoveFilters not working as expected

I have a page level filter for DaysAgo>0. This allows my MTD LY /YTD LY time calculation filters to work as expected and not go through the full month of the previous year. 

 

I am now also trying to build a measure for the full previous month of the current year, but this filter prevents it from looking past the current day (for example, it's 2/9/24 and I want full month of January, but the DAysAgo filter only shows to 1/9/24).

 

Does RemoveFilters not work on page level filter context? Is there another way to accomplish this?

 

Net Sales PrevMonth = CALCULATE([Net Sales MTD],DATEADD('Calendar'[Date Value],-1,MONTH),REMOVEFILTERS('Calendar'[Days Ago]))
5 REPLIES 5
v-nuoc-msft
Community Support
Community Support

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

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

I'm not able to provide data in that way due to company policy. 

 

Is there any reason why removefilters would not work on a page-level filter?

Sorry, I only work with sample data.  I hope someone else can help you further.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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