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
nmhung49
Helper II
Helper II

Combine Data with Different Columns on Multiple Sheets into a Single Sheet

I have 2 sheets with data

Sheet 1

Product Group 1     Customer     Produc Group 2    Amount

A                               Hiti              Arg                       10

B                               Van             Bra                         20

Sheet 2

Product Group 2    Produc Group 1    Customer    Amount

Vie                               C                      Chien                 30

Tha                              D                       Tu                      40

 

Now I want combine 2 sheet to 1 sheet in Power query or Power Bi, How?

Product Group 1     Product Group 2     Customer    Amount

A                               Arg                       Hiti                       10

B                               Bra                        Van                      20

C                               Vie                        Chien                   30

D                               Tha                       Tu                        40

 

Thanks for your help!!

6 REPLIES 6
TomMartens
Super User
Super User

Hey,

 

Import the sheets using Power Query, this will lead to two queries and then:

 

  1. Reorder the columns in one of the queries
  2. Use the Append operation in the Combine ribbon of the Home Menu:
    https://docs.microsoft.com/en-us/power-bi/desktop-shape-and-combine-data

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

@TomMartens 

I can not Reorder the columns in one of the queries

Can you help me? with example

 

Example.xlsx

 

P/s: I am not use create Table to do It

 

 

 

Hey,

 

I assume you already imported both sheets into Power BI Desktop Power Query.

From Power BI desktop open Power Query (select Edit Queries from the Home menu)

 

Select one query, mark the query you want to move to another place, drag the column using the mouse (you have to do the on the column name):

 

Power Query - Reorder Columns - Drag and Drop.gif

 

As the manual reordering is "recorded" as a transformation step, it will work even if you refresh the data.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

@TomMartens 

I know, but the data is incorect in power query in the columns

I want picture ex1 to picture ex2

Capture.JPG

Hey,

 

I'm not sure what I do not understand.
These are the steps:

1 - Import both sheets into Power Query 

I imported both sheets from your sample xlsx that you provided. After that I have to queries in Power BI, please make sure that for both queries the 1st row has been "promoted" to column headers, if this is not the case use this step:

image.png

 

2 - Reorder the columns in of the tables manually (just drag and drop)

3 - Append one table to the other


Here you will find my pbix file. Please open Power Query and have a closer look at query "Sheet2".

 

Here are step 2 and 3 in more detail.
image.png
The red rectangle marks the step that have been executed/created by Power Query automatically during the import.

The green rectangle marks the steps that I added manually afterwards

 

1st additional step - Manually reordering the column by dragging and dropping

image.png

 

2nd additional step - Append query/table Sheet1 to query/table Sheet2.
This is the Append command that I'm referencing:

image.png


If, for whatever reason you want to append query/table "Sheet2" to query/table "Sheet1", just select query "Sheet1" and execute the Append command here.
Performancewise I recommend to append the smaller table (less rows) to the larger table (more rows). 

image.png

 

The final step (at least until now) creates the table in your latest post, except the reordering, but basically this is due to how the tables are appended.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thanks @TomMartens 

I know, Currently, I'm doing it this way without reordering the column, but when Sheet added, the data doesn't automatically update, I have to repeat the following steps

Step1

Step1.JPG

 

Step2

 

Step2.JPG

 

Example pbx

Data xlsx

I want when the sheet is added, the data will automatically update to the table All, No repeat step1 and step2

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.