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
Anonymous
Not applicable

Look up value from other row of same table (like VLOOKUP in Excel)

Hello, 

I have the following table "People"

 

IDNicknameFull NameParentNicknameParentID ??
1AndyAndreas Müller  
2BertaBeate SchneiderFred? (expectet: 6)
3ClaraClaudi WagnerFred? (expectet: 6)
4DoraDaurene DaudererHarry? (expectet: 8 )
5ElmirElmar OtterbachAndy? (expectet: 1)
6FredFriedrich Holland  
7GeorgHans-Georg MeyerElmir? (expectet: 5)
8HarryHarald ZwiblerDora? (expectet: 4)

 

Now I'd like to calculate with M Query the column ParentID. So I'm looking for a function like "VLOOKUP" in Excel or in DAX:

ParentID = LOOKUPVALUE( People[ID], People[Nickname], People[ParentNickname])

It would be great, if some could help me. 

Thank you very much in advance

Andy

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@Anonymous Perhaps try Table.MatchesAnyRows.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

AlexisOlson
Super User
Super User

Merge the query with itself and expand the ID column.

AlexisOlson_0-1642523589751.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VZA9C8IwEIb/ypFZB79d1apdioODYOlwbY42EFO4tkj/m5t/zPRCC07PveHh7iVpqhZqpg5O9wFM2EDy/VhL7F9AZbNULf10JG5RiC3BvagcGS3OhUmLtvLhZJExsNMGHli6f2ntQ1SLE2HH5Ag8/SbRYmTuxdv4dLYvw4HIcGtb4hyLaiw8aNtx9wBDmk1RQVxbi05P/Xd+ulLNpVxwzVwCJNQTT2cGcT9VEKLV8HybPPyFtM6yHw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Nickname = _t, #"Full Name" = _t, ParentNickname = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Nickname", type text}, {"Full Name", type text}, {"ParentNickname", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"ParentNickname"}, #"Changed Type", {"Nickname"}, "Changed Type", JoinKind.LeftOuter),
    #"Expanded Changed Type" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type", {"ID"}, {"ParentID"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Changed Type",{{"ID", Order.Ascending}})
in
    #"Sorted Rows"

 

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

Merge the query with itself and expand the ID column.

AlexisOlson_0-1642523589751.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VZA9C8IwEIb/ypFZB79d1apdioODYOlwbY42EFO4tkj/m5t/zPRCC07PveHh7iVpqhZqpg5O9wFM2EDy/VhL7F9AZbNULf10JG5RiC3BvagcGS3OhUmLtvLhZJExsNMGHli6f2ntQ1SLE2HH5Ag8/SbRYmTuxdv4dLYvw4HIcGtb4hyLaiw8aNtx9wBDmk1RQVxbi05P/Xd+ulLNpVxwzVwCJNQTT2cGcT9VEKLV8HybPPyFtM6yHw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Nickname = _t, #"Full Name" = _t, ParentNickname = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Nickname", type text}, {"Full Name", type text}, {"ParentNickname", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"ParentNickname"}, #"Changed Type", {"Nickname"}, "Changed Type", JoinKind.LeftOuter),
    #"Expanded Changed Type" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type", {"ID"}, {"ParentID"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Changed Type",{{"ID", Order.Ascending}})
in
    #"Sorted Rows"

 

Anonymous
Not applicable

Great! Thank you for the quick solution. 

 

Greg_Deckler
Community Champion
Community Champion

@Anonymous Perhaps try Table.MatchesAnyRows.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
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!

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