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
Charmaine
Frequent Visitor

expand and merge tables (without identical columns)

Hi all, I would like to join two tables. or it is actually adding a new expanded column. The situation is as screenshot. 

Any idea how to complete this in Power BI? Thank you 😉 

song.png

2 ACCEPTED SOLUTIONS

Hi @Charmaine,

I reproduce your scenario and get expected result.

Please click "New Table" under Modeling on Home page, type the following formula, you will get expected table.

Result Table = CROSSJOIN(Table1,Table2)


2.PNG

You can download the attachment for more details.

Best Regards,
Angelia

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

 

This can be done quite easily in the Query Editor.  You may download my file from here.

 

Untitled.png


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

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

This can be done quite easily in the Query Editor.  You may download my file from here.

 

Untitled.png


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

Hi,

 

1) create a new calculated column with a single value (i.e. column "join_key" with value "1" for all rows) in both tables

2) merge tables on this column

3) expand second table

4) delete join_key column(s)

 

eniX.

Hi eniX, thanks for your guidance. but the error as below shown. I have tried to remove duplicates..

 

sss.png

Hi @Charmaine,

I reproduce your scenario and get expected result.

Please click "New Table" under Modeling on Home page, type the following formula, you will get expected table.

Result Table = CROSSJOIN(Table1,Table2)


2.PNG

You can download the attachment for more details.

Best Regards,
Angelia

Just a shot in the dark but I would guess you merged in the same query, not in the separate one. Your existing relationsship turns then from m:1 to m:n, so to an M2M (many-to-many) relationship, which is not possible in Power BI. A common workaround for this issue is to create a so called bridge table (or use an existing one).

 

Try to use table1 or table2 in your first post as the bridge table (I don't know which column you use for the relationship)

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.