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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
PurdieB
Frequent Visitor

Search for non unique values in multiple columns on a different table and return matching value.

Hello,

 

I have the two tables below (Records & Requirements) and I"m trying to create the 3rd table (Results) to display which "Requirement" the employee has from the list of options in the Requirments Table and then identify if there are any missing requirements.  

Seems like this should be a simple lookup function but nothing I've tried is getting me what I need. 

 

Please help!

 

Records Table

EmployeeJobcodeRequirement
A121AB
A121DL
B121AC
C121AD
D545AB

 

Requirements Table:

JobcodeReq 1aReq 1bReq 1cReq 2a
121ABACADDL
545QQ   

 

Results Table:

EmployeeJobcodeRequirement 1Requirement 2
A121ABDL

B

121ACMISSING
C121ADMISSING
D545MISSING 
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

let
    Requirements = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVNJRcnQCEc4gwgVIuPgoxepEK5mamAI5gYFAAopiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Jobcode = _t, #"Req 1a" = _t, #"Req 1b" = _t, #"Req 1c" = _t, #"Req 2a" = _t]),
    Records = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0MgSSjk5KsTrIAi4+YAEnhApnsIAzQsAFLOACZJqamELNiAUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Employee = _t, Jobcode = _t, Requirement = _t]),
    #"Grouped Rows" = Table.Group(Records, {"Employee", "Jobcode"}, {{"Req", each [Requirement]}}),
    Merged = Table.NestedJoin(#"Grouped Rows", "Jobcode", Requirements, "Jobcode", "req", JoinKind.LeftOuter),
    Intersection = Table.AddColumn(Merged, "rq", each List.Intersect({[Req], Record.ToList([req]{0})},Comparer.OrdinalIgnoreCase)),
    #"Extracted Values" = Table.TransformColumns(Table.RemoveColumns(Intersection, {"Req","req"}), {"rq", each Text.Combine(_, "#(tab)"), type text}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "rq", Splitter.SplitTextByDelimiter("#(tab)", QuoteStyle.Csv), {"rq.1", "rq.2"})
in
    #"Split Column by Delimiter"

Screenshot 2021-07-08 220449.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

let
    Requirements = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVNJRcnQCEc4gwgVIuPgoxepEK5mamAI5gYFAAopiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Jobcode = _t, #"Req 1a" = _t, #"Req 1b" = _t, #"Req 1c" = _t, #"Req 2a" = _t]),
    Records = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0MgSSjk5KsTrIAi4+YAEnhApnsIAzQsAFLOACZJqamELNiAUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Employee = _t, Jobcode = _t, Requirement = _t]),
    #"Grouped Rows" = Table.Group(Records, {"Employee", "Jobcode"}, {{"Req", each [Requirement]}}),
    Merged = Table.NestedJoin(#"Grouped Rows", "Jobcode", Requirements, "Jobcode", "req", JoinKind.LeftOuter),
    Intersection = Table.AddColumn(Merged, "rq", each List.Intersect({[Req], Record.ToList([req]{0})},Comparer.OrdinalIgnoreCase)),
    #"Extracted Values" = Table.TransformColumns(Table.RemoveColumns(Intersection, {"Req","req"}), {"rq", each Text.Combine(_, "#(tab)"), type text}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "rq", Splitter.SplitTextByDelimiter("#(tab)", QuoteStyle.Csv), {"rq.1", "rq.2"})
in
    #"Split Column by Delimiter"

Screenshot 2021-07-08 220449.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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.