The "View Native Query" option is greyed out, but the query has been folded
How to check Query Folding in Power Query with M code
What is query folding?
Query folding in Power Query is the process of picking up complex tasks generated by Power Query and passing them back to the database for execution. This will have a significant impact on the performance of our queries loading and processing in Power Query / Power BI.
View Native Query option:
Usually, we think that if the "View Native Query" option is disabled under " Applied Steps" in Power Query, it means query folding isn't taking place for that step.
This could be a valid check some database sources like SQL Server, but it is not always guaranteed to tell us if the query has been folded or not.
In my "BigQuery" source example, the “View Native Query” option was grayed out, even though that in reality query folding occurred.
A good tip to check if the query folding has been applied in Power Query:
So to check if a query folds, we can use these two M functions below 👇 which will give us an answer, returning isFolded = TRUE OR FALSE
==> I always suggest to check the query folding, as it will help you a lot to optimize the performance of your queries.