Forum Discussion

amal_01's avatar
amal_01
Helper I
1 year ago
Solved

Filter does not applied in power bi query

I have a table called InventTrans, and it contains a large amount of data. I applied a filter in Power Query on the InventDate column to include only records on or after 1/1/2025. However, when I click Close & Apply, it still loads all the data from the table. It looks like the filter isn't working.

 

Why is this happening?

  • Hi amal_01 

     

    Just a quick reminder based on earlier discussion shared  by MFelix  if you're still seeing all records load from the InventTrans table despite applying a date filter in Power Query, please ensure the filter step is applied before any other steps that might override it or bring in the full dataset again (like a Changed Type step or re-applied source).

     

    Also, please double-check that:

    • The InventDate column is in Date format (not Text).
    • The filter is applied early in the query steps, ideally right after the source step.

    If the issue still persists reach out to us we are happy to help!

    Looking forward for your response..

5 Replies

  • Hi amal_01 ,

     

    This may depend on a lot of things but I would do a couple of checks, I assume you have already done some of this but just double checking,

    • Data type is correct before doing the filter in this case is date
    • Be sure the format of thedate you are using in the filter is correct based on your local settings of PBI file
    • Number of rows are the same before and after the filter
      • Usually I use the Count rows on the  Transform bar

     

    • After load do a sorting of the date column to see what is the minimum and maximum value

     

    Without any data and example is difficult to understand what may be happening

     

  • Hi amal_01 ,

    If your data source is sql database can you below sql statement directly

    SELECT *
    FROM InventTrans
    WHERE InventDate >= '2025-01-01'

  • Hi amal_01 ,

     

    My guess is that the source you are using is not foldable - is it SharePoint/network folder/Excel/CSV etc.?

    In this case, Power Query can not send your filter back to the source to only retrieve the filtered rows, therefore, when you apply your query to the model, it has to load ALL the rows, then filter them in the model afterwards.

    In order to avoid this behaviour (and only load filtered rows first time) you need to use a foldable source, such as SQL Server etc.

    More detail available here:

    Solved: Query Folding - Supported and Unsupported Data Sou... - Microsoft Fabric Community

     

    Pete

    • v-aatheeque's avatar
      v-aatheeque
      Community Support

      Hi amal_01 

       

      Just a quick reminder based on earlier discussion shared  by MFelix  if you're still seeing all records load from the InventTrans table despite applying a date filter in Power Query, please ensure the filter step is applied before any other steps that might override it or bring in the full dataset again (like a Changed Type step or re-applied source).

       

      Also, please double-check that:

      • The InventDate column is in Date format (not Text).
      • The filter is applied early in the query steps, ideally right after the source step.

      If the issue still persists reach out to us we are happy to help!

      Looking forward for your response..

      • v-aatheeque's avatar
        v-aatheeque
        Community Support

        Hi amal_01 

        Just following up on your earlier steps  shared by MFelix around date filtering were you able to identify the issue?

        As you pointed out, checking the data type, local date format, and comparing row counts before and after applying the filter are great debugging steps. Also, sorting the date column post-load to verify the minimum and maximum values can often reveal hidden issues.

         

        If you’ve made progress or still need help narrowing it down, feel free to share a sample or more details I’d be happy to take another look!