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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
dabutchart
Frequent Visitor

Lookup and return multiple Rows

I have a table with 2 columns NAME and LINE MANAGER NAME.

 

Using DAX, is it possible to return a new table showing who is line managed by each name, as in 

 

Source

Name Line Manager Name
John SmithClare Simpson
Sarah JonesAlice Johnson
Alice JohnsonClare Simpson
Peter WinterClare Simpson
Clare Simpson 

 

Output

 

NameNewColumn
John Smith 
Sarah Jones 
Alice JohnsonSarah Jones
Peter Winter 
Clare SimpsonJohn Smith
Clare SimpsonAlice Johnson
Clare SimpsonPeter Winter
1 ACCEPTED SOLUTION

Hi, @dabutchart 
as @PC2790 mentioned,
here's how to do it with Self join:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY0xCoAwDEWvEjL3EuJWVIQODqVDkGADNpXW+2MVHASnwHv//3iPEyUGNDiIMoyktHGBG2IwHm2OCi7JGVuk36kwOElHzfpoR4Ui2Kxcm+92WRnuyuu/5G9h5rP9W0Tb+Q18iUHAEC4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Name ", type text}, {"Line Manager Name", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type1", {"Name "}, #"Changed Type1", {"Line Manager Name"}, "Changed Type1", JoinKind.LeftOuter),
    #"Expanded Changed Type1" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type1", {"Name ", "Line Manager Name"}, {"Name .1", "Line Manager Name.1"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Changed Type1",{"Line Manager Name", "Line Manager Name.1"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Name .1", "New Column"}})
in
    #"Renamed Columns"

vojtechsima_0-1649753826391.png

 

View solution in original post

2 REPLIES 2
PC2790
Community Champion
Community Champion

Hey @dabutchart ,

 

You can make use of PATH functions to do this.

Here, refer this

Another way is to self join the table iwth itself and get the desired result.

LOOKUPVALUE can also be used depending on your requirement

Hi, @dabutchart 
as @PC2790 mentioned,
here's how to do it with Self join:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY0xCoAwDEWvEjL3EuJWVIQODqVDkGADNpXW+2MVHASnwHv//3iPEyUGNDiIMoyktHGBG2IwHm2OCi7JGVuk36kwOElHzfpoR4Ui2Kxcm+92WRnuyuu/5G9h5rP9W0Tb+Q18iUHAEC4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Name ", type text}, {"Line Manager Name", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type1", {"Name "}, #"Changed Type1", {"Line Manager Name"}, "Changed Type1", JoinKind.LeftOuter),
    #"Expanded Changed Type1" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type1", {"Name ", "Line Manager Name"}, {"Name .1", "Line Manager Name.1"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Changed Type1",{"Line Manager Name", "Line Manager Name.1"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Name .1", "New Column"}})
in
    #"Renamed Columns"

vojtechsima_0-1649753826391.png

 

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!

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