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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
nibitbabu
New Member

Can we query Data model in Power BI with complex SQL instead of drag and drop table columns

Can we query or build a report from Power BI Data model ( already loaded using Get data ) with SQL statements already.
It seems like sql can be used only to load data into the Power BI model using DirectQuery--> Advanced options.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @nibitbabu ,

Base on your description, it seems that you want to load multiple queries into Power BI base on one SQL statement. However, currently Power BI doesn't support this feature. You can refer the following official documentation to load one query first:

Import data from a database using native database query - Power Query | Microsoft Learn


  1. Connect to a SQL Server database using Power Query. Select the SQL Server database option in the connector selection.

  2. In the SQL Server database popup window:

    1).Specify the Server and Database where you want to import data from using native database query.

    2).Under Advanced options, select the SQL statement field and paste or enter your native database query, then select OK.

    vyiruanmsft_0-1703832571088.png

Then you can repeat the above steps for each SQL statement you want to load in Power Query.

vyiruanmsft_1-1703832830746.png

Best Regards

View solution in original post

3 REPLIES 3
nibitbabu
New Member

Thanks @tachytechtom, I believe you got my question exactly i.e. how to use sql queries against semantic model in Power BI to generate reports and there does not seem to be a stright forward solution.

Is ther any way to atleast import mutiple data Queries(Power BI) using one connection. i.e. after connecting to the database once. I want to import all the complex SQL queries/reports at once without doing a connection to the source for individual queries.

Anonymous
Not applicable

Hi @nibitbabu ,

Base on your description, it seems that you want to load multiple queries into Power BI base on one SQL statement. However, currently Power BI doesn't support this feature. You can refer the following official documentation to load one query first:

Import data from a database using native database query - Power Query | Microsoft Learn


  1. Connect to a SQL Server database using Power Query. Select the SQL Server database option in the connector selection.

  2. In the SQL Server database popup window:

    1).Specify the Server and Database where you want to import data from using native database query.

    2).Under Advanced options, select the SQL statement field and paste or enter your native database query, then select OK.

    vyiruanmsft_0-1703832571088.png

Then you can repeat the above steps for each SQL statement you want to load in Power Query.

vyiruanmsft_1-1703832830746.png

Best Regards

tackytechtom
Most Valuable Professional
Most Valuable Professional

Hi @nibitbabu ,

 

Not sure, whether I fully got your question, but I'll give it a try 🙂

 

I do not think you can use SQL to directly query the semantic model, but there are ways to shoot queries i.e. by using the ExecuteQueries API (https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries) or by using the new semantic link (What is semantic link (preview)? - Microsoft Fabric | Microsoft Learn). With the latter, I guess you could use some kind of sql dialect on top of dataframes. 

 

Hope this helps at least a bit 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.