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

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

Reply
njohny
Frequent Visitor

Execute Query from table in power bi

Hi,

 

I have a table that has several queries saved in a column as follows:

 

IDQuery
001Select top 10 * from table1;
002Sleect top 10 * from table 2;

and so on...

 

How can I get power bi to run these queries as direct query into snowflake and display the result data set via drill through ?

 

Any help is appreciated.

1 REPLY 1
danextian
Super User
Super User


Hi @njohny 
I don't think what you are tying to achieve is currently possible. Visuals are used to visualize the underlying data but not to send a query back to the database in away that you want it to. You can use parameters to affect a query (filter, change data source, etc) but there should already an existing query to affect them to.
As an alternative, you can:

 

  • bring in each SQL query as a data source, add an ID column to each containing their assigned ID and combine them all into one table in power query.
  • bring in a table (you can use enter data, connect to an excel file saved locally or in the cloud, or connect to a google spreadsheet) containing a column for ID, server path, database name, table name, query, etc and use Sql.Database and those columns to bring in the desired data. That would be something like

 

Sql.Database([server path], [database name], [Query = [query column] ] )​

There are other ways to acces the desired table/views using the above method. This can be overwhelming id you're knew to Power BI but the flexibility allows one to have multiple ways to access a data source. Here's a documentation for this PQ function - https://learn.microsoft.com/en-us/powerquery-m/sql-databaseGoing back, the above alternatives still require that one start with a query to connect to a data source.

Note: Other users might have a better idea.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.