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.
I need ti union two tables from SQL Server in power BI. But the issue is that the number of columns are not same for both the tables. So union()/concadenate() is not possible in Power BI.
So I tried the append and connected to Database.
It is good but the values are wrong.
So there any other ways to union these two tables in Power BI
Solved! Go to Solution.
Hi, @asdf1608
According to your description, you want to union the two tables which has differnt column names.
Here are the steps you can refer to :
This is my test data:
[1]We can crealize it in Power Query Editor. we can create a Blank Query and enter this:
= Table.RenameColumns(#"Table 2",{{"Stu_Name", "Name"}, {"Class_Name", "Class"}}) & #"Table 1"
Then we can get this and you can also remove the column you do not want to in it :
[2]We can also realize it in Power Bi Desktop:
We can click "New Table" and enter this:
Table = UNION( SELECTCOLUMNS( ADDCOLUMNS('Table 2',"Teacher", BLANK()) ,"Name",[Stu_Name],"Class",[Class_Name],"Source",[Source],"Teacher",[Teacher]) , 'Table 1')
Then we can also meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi, @asdf1608
According to your description, you want to union the two tables which has differnt column names.
Here are the steps you can refer to :
This is my test data:
[1]We can crealize it in Power Query Editor. we can create a Blank Query and enter this:
= Table.RenameColumns(#"Table 2",{{"Stu_Name", "Name"}, {"Class_Name", "Class"}}) & #"Table 1"
Then we can get this and you can also remove the column you do not want to in it :
[2]We can also realize it in Power Bi Desktop:
We can click "New Table" and enter this:
Table = UNION( SELECTCOLUMNS( ADDCOLUMNS('Table 2',"Teacher", BLANK()) ,"Name",[Stu_Name],"Class",[Class_Name],"Source",[Source],"Teacher",[Teacher]) , 'Table 1')
Then we can also meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.