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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
o59393
Post Prodigy
Post Prodigy

How to merge or combine 2 tables with different structure

Hi all

 

How can I merge 2 tables that have different structure?

 

I would like to merge to a table called "Lines" the months from table "Months & units"

 

In this case the table lines should go from this:

 

dsfdsfs.JPG

 

To this:

 

rdeires.JPG

 

As seen, each of the 3 products or row, were assigned all the available months. So, column F "month" highlighted in light blue is the result desired.

 

The months as mentioned come from table "Months & units" but I also added on power bi a month table with its unique values called "month catalog"

 

How can I get the months merged to my table "lines"?

 

pbix and excel are attached:

 

https://1drv.ms/u/s!ApgeWwGTKtFdhni9c6kuDioLhq0H?e=SvaW8g

 

Thanks!

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

See the Lines table of this file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

See the Lines table of this file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

 

I see this

 

asdada.JPG

 

Regards.

Hi,

Save the Excel file on your desktop.  Double click on Source and link to the Excel file on your desktop.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

You can do a table merge on more than one column. Select all the common columns from both tables during the dialog.

 

Another way is to use a custom combiner function for Table.AddColumn .

Hi @lbendlin 

 

And how to I merge both? From table "Month Catalog" or "Month & Units" to table "lines" by using Power Query.

 

Thanks.

For example:

 

let
    Source = Table.NestedJoin(Lines, {"Country", "Plant", "Line"}, #"Months & Units", {"Country", "Plant", "Line"}, "Months & Units", JoinKind.Inner)
in
    Source

Hi @lbendlin 

 

I want to my table lines, opened the editor and did this:

 

asdasdasd.JPG

But got an error, reading your code, where is it bringing the months to the table lines?

 

Thanks.

You need to put my code in a new, blank query

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.