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

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

Reply
Vampirtc
Frequent Visitor

Extract records from Table to Text

The problem is the following:
I need to match two tables, I'm using Left Outer Join.

Second table can have 0,1,2 or more matches.

If I use expand after matching the columns are duplicated.

What I want is to extract matching result (Table) to a single text string.


For example, table1:

ID name
1    mark
2    jack
3    robert
Table2:
ID profession  phone
1 health
1 cleaning
2 manager

after join by using ID
ID name     joined
1    mark    health,cleaning
2    jack      manager
3    robert  null

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

@Vampirtc , you are only one step away from your goal,

let
    Table1 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUcpNLMpWitWJVjICcrISkyEcYyCnKD8ptahEKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, name = _t]),
    Table2 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUcpITcwpyVCK1YFwk3NSE/My89LBAkZAgdzEvMT01CKl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Profession = _t]),
    #"Left Outer join" = Table.NestedJoin(Table1, "ID", Table2, "ID", "joined", JoinKind.LeftOuter),
    Concatenation = Table.TransformColumns(#"Left Outer join", {"joined", each Text.Combine([Profession], ", ")})
in
    Concatenation

Screenshot 2021-04-26 180237.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

1 REPLY 1
CNENFRNL
Community Champion
Community Champion

@Vampirtc , you are only one step away from your goal,

let
    Table1 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUcpNLMpWitWJVjICcrISkyEcYyCnKD8ptahEKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, name = _t]),
    Table2 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUcpITcwpyVCK1YFwk3NSE/My89LBAkZAgdzEvMT01CKl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Profession = _t]),
    #"Left Outer join" = Table.NestedJoin(Table1, "ID", Table2, "ID", "joined", JoinKind.LeftOuter),
    Concatenation = Table.TransformColumns(#"Left Outer join", {"joined", each Text.Combine([Profession], ", ")})
in
    Concatenation

Screenshot 2021-04-26 180237.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors