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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ajaydev
Regular Visitor

joining two tables but i also have 30 noncommon rows in the second table.

I have two tables with columns batsman,batsmanruns & bowler,wickets .I want to merge them as player,runs,wicket .But the problem is there are 30 bowlers who are not present in the batsman column.how do i merge them too into the table.What is the right method?

2 REPLIES 2
parry2k
Super User
Super User

@ajaydev Alternatively you can just create a table with a unique list of players and then set the relationship of this new table with each table, and in the table visual, you can pull players from this new table, and runs/wickets from the respective table. No need to do the merge in PQ, just create a table of players.

 

let
    // Create unique tables of players
    Source = Table.FromList(List.Distinct(List.Combine({Batsman[Batsman], Bowler[Bowler]}))),
    #"Renamed Columns" = Table.RenameColumns(Source,{{"Column1", "Player"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Player", type text}})
in
    #"Changed Type"

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@ajaydev create a new blank query and add the following M expression. In this code I'm assuming tables names are Batsman and Bowler.

 

let
    // Create unique tables of players
    Source = Table.FromList(List.Distinct(List.Combine({Batsman[Batsman], Bowler[Bowler]}))),
    #"Renamed Columns" = Table.RenameColumns(Source,{{"Column1", "Player"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Player", type text}}),
    // Merge with Batsman table to get Runs
    #"Merged Queries - Batsman" = Table.NestedJoin(#"Changed Type", {"Player"}, Batsman, {"Batsman"}, "Batsman", JoinKind.LeftOuter),
    #"Expanded Batsman" = Table.ExpandTableColumn(#"Merged Queries - Batsman", "Batsman", {"Run"}, {"Run"}),
    // Merge with Bowler table to get Wickets
    #"Merged Queries - Bowler" = Table.NestedJoin(#"Expanded Batsman", {"Player"}, Bowler, {"Bowler"}, "Bowler", JoinKind.LeftOuter),
    #"Expanded Bowler" = Table.ExpandTableColumn(#"Merged Queries - Bowler", "Bowler", {"Wickets"}, {"Wickets"})
in
    #"Expanded Bowler"

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors