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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
PowerBIlearner
Frequent Visitor

Custom SQL instead of table or view

Hello,


Can you tell me how do I write the custom sql/ derived table to join to existing tables from the databases? I would like to be able to use derived table. The only options I see is I can use tables/views from the database. Thank you in advance.

 

@ankitpatira

@Greg_Deckler

@BhaveshPatel

@Seth_C_Bauer

@v-haibl-msft

@ImkeF

@Baskar

@Sean

 

Shruthi

2 ACCEPTED SOLUTIONS
Seth_C_Bauer
Community Champion
Community Champion

@PowerBIlearner When you connect to the SQL Server you can expand the "Advanced options" and input a SQL query to pull in the data that you want.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

v-qiuyu-msft
Community Support
Community Support

Hi @PowerBIlearner,

 

When we connect to SQL Server data source, we can use derived tables in the T-sql query, you can refer to the sample below:

 

q3.PNGq4.PNGq5.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @PowerBIlearner,

 

When we connect to SQL Server data source, we can use derived tables in the T-sql query, you can refer to the sample below:

 

q3.PNGq4.PNGq5.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, it helped !

...and when you have 15 queries so that you want 15 datasets then you do the SQL conneciton 15 times - just genious on Microsoft's part (sarcasm) 

Seth_C_Bauer
Community Champion
Community Champion

@PowerBIlearner When you connect to the SQL Server you can expand the "Advanced options" and input a SQL query to pull in the data that you want.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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