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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rajcha
Frequent Visitor

How to give 2 or more data sources in blank query

I have a requirement where I have to join two tables from two different data sources. I have selected the blank query option and I am writing the query in the advanced editor option available in the query editor. This advanced editor allows me to enter only one data source. Is there a way where I can give two or more data sources.

 

The below works.

 

let
 Source = Sql.Database("servername", "datasource1",
   [Query="SELECT BusinessEntityID, FirstName, MiddleName, LastName,
     JobTitle, City, StateProvinceName, CountryRegionName, TerritoryName,
     TerritoryGroup, SalesYTD, SalesLastYear
     FROM Sales.vSalesPerson;"])
in
 Source
 
"datasource1" is one data source.
My question is how to add another datasource.
 
Thanks.
2 ACCEPTED SOLUTIONS
ImkeF
Super User
Super User

No reason to make life unnecessarily difficult: Just use the import functions for 2 different queries and then join them afterwards.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

@rajcha I think there is a little confusion here. You can write your SQL queries, as Imke suggests, do this in two seperate queries. Then, in Power BI, you can use merge or append them depending on your needs.


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

3 REPLIES 3
ImkeF
Super User
Super User

No reason to make life unnecessarily difficult: Just use the import functions for 2 different queries and then join them afterwards.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

rajcha
Frequent Visitor

I have to use temp tables in my query. So writing a query is unavoidable in my case. 

@rajcha I think there is a little confusion here. You can write your SQL queries, as Imke suggests, do this in two seperate queries. Then, in Power BI, you can use merge or append them depending on your needs.


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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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