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
akj2784
Post Partisan
Post Partisan

SQL Based query for Power BI Report

Hi All,

 

Is there any way to get SQL query for the report I run in Power Bi Desktop. ?

 

Or Is there any way to convert DAX query into SQL based query so that it becomes easier to debug. ?

 

Regards,

Akash

1 ACCEPTED SOLUTION
stretcharm
Memorable Member
Memorable Member

You cannot get SQL from DAX as it's a very different thing.

 

I don't think this is what you want but you can get to see the query from M (Query Editor) if you've imported a table and applied some filters.

https://blog.crossjoin.co.uk/2017/06/11/query-folding-and-writing-your-own-sql-queries-in-power-quer...

 

It is possible to get the dax queries using SQL Profiler, but this is quite advanced stuff. Here is an example for tabular SSAS and Powerbi can be connected to in a similar way.

http://mdxdax.blogspot.co.uk/2011/12/dax-query-plan-part-1-introduction.html

 

I tend to build simple tables of all my columns and filters while I'm testing my model, then discard when I'm happy with everything,

Its key to test measures at a variety of different levels as this is where things can go wrong.

 

For help with DAX here are some good sites.

https://www.youtube.com/watch?v=klQAZLr5vxA

https://www.sqlbi.com/topics/dax/

https://powerpivotpro.com/2014/10/5-common-mistakes-made-by-self-taught-dax-students/

https://christso.com/debugging-dax-formulas-with-excel/

View solution in original post

2 REPLIES 2
stretcharm
Memorable Member
Memorable Member

You cannot get SQL from DAX as it's a very different thing.

 

I don't think this is what you want but you can get to see the query from M (Query Editor) if you've imported a table and applied some filters.

https://blog.crossjoin.co.uk/2017/06/11/query-folding-and-writing-your-own-sql-queries-in-power-quer...

 

It is possible to get the dax queries using SQL Profiler, but this is quite advanced stuff. Here is an example for tabular SSAS and Powerbi can be connected to in a similar way.

http://mdxdax.blogspot.co.uk/2011/12/dax-query-plan-part-1-introduction.html

 

I tend to build simple tables of all my columns and filters while I'm testing my model, then discard when I'm happy with everything,

Its key to test measures at a variety of different levels as this is where things can go wrong.

 

For help with DAX here are some good sites.

https://www.youtube.com/watch?v=klQAZLr5vxA

https://www.sqlbi.com/topics/dax/

https://powerpivotpro.com/2014/10/5-common-mistakes-made-by-self-taught-dax-students/

https://christso.com/debugging-dax-formulas-with-excel/

The latest Dax Studio has a way of capturing the DAX code for debugging.

All is explained in this video.

https://www.sqlbi.com/tv/dax-studio-2-7-improved-debug-experience/

 

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.