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
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
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.