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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Grove
New Member

Creating Data Tables for Multiple SQL Outputs within 1 Query

I want to use just 1 query to create multiple data tables using the multiple outputs. Is this possible? When I run the query in SQL, multiple outputs are generated, is there a way to do the same in power bi? It seems it would be most efficient to run the query once, since subsequent tables use prior temp tables/outputs depend on earlier tables in the query.

 

For example, in the below SQL would create output1 and output2 tables. HJow do I replicate this is power bi? if possible?

 

Thanks

 

IF OBJECT_ID('tempdb..#Output1') IS NOT NULL DROP TABLE #Output1;

select * into #Output1 from data_source

select * from #Output1

 

IF OBJECT_ID('tempdb..#Temp2') IS NOT NULL DROP TABLE #Temp2;

select * into #Temp2 from #Output1

 

IF OBJECT_ID('tempdb..#Output2') IS NOT NULL DROP TABLE #Output2;

select * into #Output2 from #Temp2

select * from #Output2

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Grove ,

It is possible to create multiple data tables from one query in Power BI. You can use the Power Query Editor to merge or append tables based on matching values from one or multiple columns. You can also use different types of joins, such as inner, left outer, right outer, full outer, or cross join, depending on the output you want.

 

Merge queries overview - Power Query | Microsoft Learn

Append queries - Power Query | Microsoft Learn

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details.

 

Best Regards
Community Support Team _ Rongtie

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

1 REPLY 1
Anonymous
Not applicable

Hi @Grove ,

It is possible to create multiple data tables from one query in Power BI. You can use the Power Query Editor to merge or append tables based on matching values from one or multiple columns. You can also use different types of joins, such as inner, left outer, right outer, full outer, or cross join, depending on the output you want.

 

Merge queries overview - Power Query | Microsoft Learn

Append queries - Power Query | Microsoft Learn

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details.

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.