Forum Discussion
How to enable query folding from a salesforce object
My goal is to enable incremental refresh on our data that is being imported using the power bi salesforce connector. To enable incremental refresh, query folding must be happening. Currently, “View Native Query” is greyed out even in the first steps of the query. This indicates query folding is not happening. How do I enable "View Native Query"? Is it possible?
"Currently, “View Native Query” is greyed out even in the first steps of the query. This indicates query folding is not happening."
You would think that, but it is incorrect. Query folding is happening in some limited fashion, specifically for column selection and column filtering. Custom SOQL will be generated for some of the Power Query transforms. You can check this in the Power Query Diagnostics output - it will show the custom SOQL query HTTP call.
Since SOQL is quite different from SQL I think Microsoft decided not to use the term "Query Folding" and not to show the custom SOQL in the "View Native Query" part.
Note that the custom SOQL is limited to in-object queries. Relationship queries are not currently supported, so you cannot reproduce SFDC Report Types in Power BI just yet.
7 Replies
- lbendlin
Super User
"Currently, “View Native Query” is greyed out even in the first steps of the query. This indicates query folding is not happening."
You would think that, but it is incorrect. Query folding is happening in some limited fashion, specifically for column selection and column filtering. Custom SOQL will be generated for some of the Power Query transforms. You can check this in the Power Query Diagnostics output - it will show the custom SOQL query HTTP call.
Since SOQL is quite different from SQL I think Microsoft decided not to use the term "Query Folding" and not to show the custom SOQL in the "View Native Query" part.
Note that the custom SOQL is limited to in-object queries. Relationship queries are not currently supported, so you cannot reproduce SFDC Report Types in Power BI just yet.
- v-henryk-mstf
Community Support
Hi Anonymous ,
For your description, the idea behind query folding is to push the logic built into the Power BI query back to the data source server, and then execute the logic in its native language instead of client-side conversion of the data.
After clicking it, it shows the native SQL statement that satisfies the query folding rules. If a conversion that does not support query folding is introduced, such as capitalizing each word, then the native query option is disabled.
You can check the following related soltion and blog:
Solved: Re: View Native Query always disabled - Microsoft Power BI Community
Power BI - Checking Query Folding with View Native Query (pragmaticworks.com)
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - Syndicate_Admin
Administrator
Good afternoon
That is, if I connect Power BI to Salesforce Objects there is no way to fold queries?
Or is it produced but partially so it would not work either?Thanks a lot
Slds
Juampi
- lbendlin
Super User
See my earlier response. Query folding is attempted, but you have no control over the produced SOQL code. Like with other sources - if you apply certain transforms then you can prevent even the attempt from happening.
- metrica
Post Prodigy
Hi everyone,
Adding context for anyone landing here from search - lbendlin's diagnosis is still accurate in 2026. The native Salesforce Objects connector does some implicit SOQL folding (column projection and simple filters), but with two practical limitations: you don't have direct control over what gets pushed down, and more complex transforms (especially anything involving relationships or merges) often break the folding chain. For incremental refresh on large objects, this can mean pulling more rows than your filter logic implies before Power Query trims them down.
If you'd prefer an explicit filter configured on the Salesforce side instead of relying on Power Query's implicit folding, Metrica Power BI Connector for Salesforce on AppExchange is one approach worth knowing about - the filter and field selection live in a Salesforce-side UI, so the dataset that reaches Power BI is already scoped to what you actually want.
Free 30-day trial if you want to see how it handles your objects in practice. Setup guides and more details on https://metricasoftware.com/power-bi-connector-for-salesforce/, and we're around for a quick demo if that's easier.
Cheers,
Metrica Team.