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
Gayatrik
New Member

Unable to figure out the correct way to accomplish join on matching column.

Hi All,

 

I have 2 tables (TABLE1 and TABLE2), that have 1 column(ColumnX) in common. Below are examples of the two tables and what resultant table I need from joining both of them.

TABLE1

COLUMNXCOLUMNY
1A
1B
2A
3B

 

TABLE2

COLUMNXCOLUMNZ
1abcd
2efgh
3ijk
4lmno

 

I'm trying to find a way to join these tables so that the resultant table looks like .

COLUMNXCOLUMNYCOLUMNZ
1Aabcd
1Babcd
2Aefgh
3Bijk

 

I can't seem to figure out the correct join to get the desired output.
Thanks 

3 REPLIES 3
Dinesh_Suranga
Continued Contributor
Continued Contributor

@Gayatrik 

Hi,

Try following M code

let
Source = Table.NestedJoin(TABLE1, {"COLUMNX"}, TABLE2, {"COLUMNX"}, "TABLE2", JoinKind.LeftOuter),
#"Expanded TABLE2" = Table.ExpandTableColumn(Source, "TABLE2", {"COLUMNZ"}, {"COLUMNZ"})
in
#"Expanded TABLE2"

Dinesh_Suranga_0-1665712929949.png

If this solved your problem, please accept as the solution.

Thank you.

Anonymous
Not applicable

Is this M query, a new column, or DAX? You can build them all but they have different verbiage and different uses.

 

Trying to accomplish this with power query. What approach would you suggest?

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.