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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tylerfutures
Frequent Visitor

See underlying SQL Query

Hello,

I'd like to see if its possible to connect to a SQL database, import data, make some changes (change the data type, merge columns, etc) and then see what the underlying SQL query is when I'm done.  I understand that Advanced Editor merely shows the M code and View Native Query only shows the query up to a certain point and does not include any changes like merging columns.


Essentially I was hoping there was a way I could do data manipulation/discovery in Power BI and then grab the underlying code and then plug it into SSMS as a way to bypass writing my own code...I do not exactly have the strongest SQL skills!

 

Thank you!

2 REPLIES 2
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@tylerfutures,

In Power BI Desktop, with query folding feature, you are able to view the undelying SQL query.

However,  some transformations(steps) can be translated to T-SQL, but some not such as Merge Column. In this case, you will not able to view the underlying SQL query for some steps. For those transformations that don't support query folding, consider to write your own expressions.

For example, instead of using Merge Columns , you can add a custom column by writing your own expression, then you should be able to use view native query option to see underlying query. For more details, please review the following blog.

http://radacad.com/not-folding-the-black-hole-of-power-query-performance

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tylerfutures
Frequent Visitor

Hello,

I'd like to see if its possible to connect to a SQL database, import data, make some changes (change the data type, merge columns, etc) and then see what the underlying SQL query is when I'm done.  I understand that Advanced Editor merely shows the M code and View Native Query only shows the query up to a certain point and does not include any changes like merging columns.


Essentially I was hoping there was a way I could do data manipulation/discovery in Power BI and then grab the underlying code and then plug it into SSMS as a way to bypass writing my own code...I do not exactly have the strongest SQL skills!

 

Thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Kudoed Authors