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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
wpf_
Post Prodigy
Post Prodigy

Are M code filtering done in the data source?

If i just want to filter a table in query editor for just active records, is the filtering done in the data source before it sends the data over to BI, or is all the data sent over to BI first, then filtered in BI?

 

I was wondering if the more filtering i do in query editor would slow down my report.  Thanks 

1 ACCEPTED SOLUTION

Hi @wpf_ ,

 

When you filter in power query editor, it takes time and resources to filter. 

It's always recommended to filter your data in the early stages of your query or as early as possible. Some connectors will take advantage of your filters through query folding, as described in Power Query query folding. It's also a best practice to filter out any data that isn't relevant for your case. This will let you better focus on your task at hand by only showing data that’s relevant in the data preview section.

We recommend that you strive to achieve efficiency in your model designs by ensuring query folding occurs whenever possible.

 

 

 

Best Regards,

Stephen Tao

 

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

View solution in original post

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @wpf_ ,

 

I think this is also related to your connection mode.

If it is the import mode, it will import all data into Power BI. Therefore, if your data is filtered before importing, the performance of the report will be better.

If the connection is DirectQuery. It is a direct connection to data source. Data will NOT be stored in Power BI model. Power BI will be a visualization layer, then query the data from data source every time.

And the last connection mode is Live connection. There's no Power Query in this mode..

 

Reference: DirectQuery, Live Connection or Import Data? Tough Decision!

 

 

Best Regards,

Stephen Tao

 

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

@v-stephen-msft 

 

when i filter in power query editor, doesn’t that take resources and time to filter even though it is being done in data source? Or is that still more efficient then bringing all the data over?

Hi @wpf_ ,

 

When you filter in power query editor, it takes time and resources to filter. 

It's always recommended to filter your data in the early stages of your query or as early as possible. Some connectors will take advantage of your filters through query folding, as described in Power Query query folding. It's also a best practice to filter out any data that isn't relevant for your case. This will let you better focus on your task at hand by only showing data that’s relevant in the data preview section.

We recommend that you strive to achieve efficiency in your model designs by ensuring query folding occurs whenever possible.

 

 

 

Best Regards,

Stephen Tao

 

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

jthomson
Solution Sage
Solution Sage

I think where the filtering is done depends on the type of data source you're using, and whether the manipulations you're doing support query folding.

 

In terms of whether it'd slow down the report, I can't see how that'd ever be the case

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors