Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext 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
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
| Employee | Jobcode | Requirement |
| A | 121 | AB |
| A | 121 | DL |
| B | 121 | AC |
| C | 121 | AD |
| D | 545 | AB |
Requirements Table:
| Jobcode | Req 1a | Req 1b | Req 1c | Req 2a |
| 121 | AB | AC | AD | DL |
| 545 |
Results Table:
| Employee | Jobcode | Requirement 1 | Requirement 2 |
| A | 121 | AB | DL |
B | 121 | AC | MISSING |
| C | 121 | AD | MISSING |
| D | 545 | MISSING |
Solved! Go to Solution.
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"
| 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! |
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"
| 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! |
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 33 | |
| 32 | |
| 31 |