Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone! I hope you are doing fine!
I need to merge two different tables and add values to one of them to each value I have in the dimesion table. For example:
In one table I have the name of the training and who did it.
In the other, I have the name of the Trainings:
What I need is to discover what training were not done yet:
In this case, I know that the blank rows is the missing trainings.
Is that a way to do this with DAX or M? I've tried several forms using union, except, join in DAX and All the merge options in Power Query, but I have success only using 1 number.
Let me know if you need some extra info. Thanks!
https://drive.google.com/file/d/1Jha1Pgxr-_erpdomTIEwriC2QVdtHEbF/view?usp=sharing
Solved! Go to Solution.
This can be done in Power Query, here is one possible implementation:
let
Fonte = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjAwMFTSUQopSszMy8xLN1SK1cEQNMImaIxN0ASboClM0AibRUbYLDIipN0cJmiM6qRYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Number = _t, Training = _t]),
#"Grouped Rows" = Table.Group(Fonte, {"Number"}, {{"Rows", each _, type table [Number=nullable text, Training=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Ref", each Trainings),
#"Expanded Ref" = Table.ExpandTableColumn(#"Added Custom", "Ref", {"All Trainings"}, {"All Trainings"}),
#"Added Custom1" = Table.AddColumn(#"Expanded Ref", "Training", each if List.Contains([Rows][Training],[All Trainings]) then [All Trainings] else null),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom1",{"Number", "All Trainings", "Training"})
in
#"Removed Other Columns"
See attached.
This can be done in Power Query, here is one possible implementation:
let
Fonte = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjAwMFTSUQopSszMy8xLN1SK1cEQNMImaIxN0ASboClM0AibRUbYLDIipN0cJmiM6qRYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Number = _t, Training = _t]),
#"Grouped Rows" = Table.Group(Fonte, {"Number"}, {{"Rows", each _, type table [Number=nullable text, Training=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Ref", each Trainings),
#"Expanded Ref" = Table.ExpandTableColumn(#"Added Custom", "Ref", {"All Trainings"}, {"All Trainings"}),
#"Added Custom1" = Table.AddColumn(#"Expanded Ref", "Training", each if List.Contains([Rows][Training],[All Trainings]) then [All Trainings] else null),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom1",{"Number", "All Trainings", "Training"})
in
#"Removed Other Columns"
See attached.
Hey Ibendlin! Thank you so much for this!
It was exactly what I was in need! Have a nice week!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
96 | |
75 | |
63 | |
62 |
User | Count |
---|---|
135 | |
105 | |
104 | |
80 | |
65 |