Forum Discussion
View Original SQL statement on Power BI desktop
- 5 years ago
Hi, Bokchoy
According to your description, your dataset is created by SQL statement, which means that you have placed some SQL statement here, right?
If so, I guess that is the reason why your “native query” option is greyed out.
Power Query cannot fold if you do that. If you want to do your own SQL plus have PQ fold more stuff, you need to create a view on your server and connect to that, or create ALL transformations in Power Query.
What’s more, one step in your query disabled “view native query”, the rest also can’t support it anymore. You can refer to this document to learn the reasons why query folding is disabled:
https://docs.microsoft.com/en-us/power-query/power-query-folding
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Bokchoy , In power query, Right click on the table, open advance editor. You should see SQL there
Hi amitchandak ,
The advanced query only shows me the applied steps that are used to transform the table. I'm looking for the native SQL query statement that was used to construct the table before its loaded into BI
Also when I right-click on the last applied step, the native query option is greyed out.
- v-robertq-msft5 years agoCommunity Support
Hi, Bokchoy
According to your description, your dataset is created by SQL statement, which means that you have placed some SQL statement here, right?
If so, I guess that is the reason why your “native query” option is greyed out.
Power Query cannot fold if you do that. If you want to do your own SQL plus have PQ fold more stuff, you need to create a view on your server and connect to that, or create ALL transformations in Power Query.
What’s more, one step in your query disabled “view native query”, the rest also can’t support it anymore. You can refer to this document to learn the reasons why query folding is disabled:
https://docs.microsoft.com/en-us/power-query/power-query-folding
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
Where did he ask about query folding? He just wants to see the original SQL query. As do I. I was given a report from someone else who used those options.
- CNENFRNL5 years agoCommunity Champion
Bokchoy , query folding, literally means PBI pushes as much workload of query as possible to the database side, isn't 100% guaranteed at the PBI side; when a query contains some functions without a SQL equivalent, query folding doesn't happen.
You might try to right click on preceding applied steps to see if there're any native query options available.