Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Good morning,
I have a set of data , however, as you would expect when doing a full join, duplicate values are created for missing rows. The data is correct, but my question is, what is the best way to remove the duplicate values in eQty so that the totals align? Is there a good way to do this?
Thanks in advance
Hi @v-yingjl
Thanks for your response, however, this does not work. These are two seperate tables that are being joined, with a different order and rows. Creating new indices and merging on them does not work.
Below is what I'm using at the moment.
let
Source = Table.NestedJoin(MBOMLookup,
{
"Component",
"Component unit",
"Proj",
"MBOMData.EBOM"
},
EBOMLookup,
{
"Component",
"Component unit",
"Proj",
"EBOMData.Immediate Parent"
},
"EBOMLookup",
JoinKind.FullOuter
),
Hi @lklenner ,
One of the join kinds available in the Merge dialog box in Power Query is a full outer join, which brings in all the rows from both the left and right tables.
If want to get the expected output, need to add an index column in each table, and then use merge based on Component column and Index column.
Example:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCgq2cjYytrSwNDBQ0lFyNTAwNDfSNTI2NATyDI30gKKxOthUWRjpmlkaWKKrcrQ0MrIASiPMMjQwMzACKQOrigUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Component = _t, Id = _t, eQty = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Component", type text}, {"Id", type text}, {"eQty", Int64.Type}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
#"Merged Queries" = Table.NestedJoin(#"Added Index", {"Component", "Index"}, Table2, {"Component", "Index"}, "Table2", JoinKind.FullOuter),
#"Expanded Table2" = Table.ExpandTableColumn(#"Merged Queries", "Table2", {"Component", "Id", "eQty"}, {"Table2.Component", "Table2.Id", "Table2.eQty"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Table2",{"Index"}),
#"Sorted Rows" = Table.Sort(#"Removed Columns",{{"Component", Order.Descending}, {"Table2.Component", Order.Descending}}),
#"Filled Down" = Table.FillDown(#"Sorted Rows",{"Component", "Table2.Component"})
in
#"Filled Down"
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
72 | |
67 | |
42 | |
28 | |
21 |