Forum Discussion
Rob112358
2 years agoFrequent Visitor
Power Query - Self Referencing Sheet Failure
Actual Problem I’m trying to solve: Item numbers do not have unique customers. Some customers were assigned inappropriately through the ERP system, duplicating the item number. This duplication c...
- Anonymous2 years ago
Hi Rob112358
1.You can use add index group by the [Part_No] and [Main_part_key], the step you cna refer to the following link.
Numbering Grouped Data in Power Query • My Online Training Hub
2.Then filter the index column(created in fiest setp) to filter the index equal 1
Then when you refresh the datasouce , it will always will return the fist record without repeating.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 2 years ago
Try this:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwMDQ0UdJRCijKTylNLlHIS8xNVVA2BIqYG5hbGpsBGc75RUWpQCnn0uKS/NzUIoi0W2ZeZnFGaooCTKeuglNpTrZSrA5xpganJufnpSQWVcLNJcZQMwxDjUCGGhobmRphdaoRdlMDEpOzE9NTU4g2mVjnYhpsjmGwMcxgY6xONqaSyaQ7ORYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"GOLD PL_PartMain [Part_No]" = _t, #"GOLD PL_PartMain [Part_Name]" = _t, #"GOLD PL_PartMain [Main_Part_Key]" = _t, #"GOLD PL_CommonCustomerPart [Customer_Name]" = _t, #"GOLD PL_PartMain [Part_Type]" = _t]), #"Grouped Rows" = Table.Group(Source, {"GOLD PL_PartMain [Main_Part_Key]"}, {{"All", each Table.FirstN(_, 1)}}), // This step expands every column except 1st column of prev. step "Grouped Rows" which is "GOLD PL_PartMain [Main_Part_Key]" #"Expanded All Dynamic" = Table.ExpandTableColumn(#"Grouped Rows", "All", List.Select(Table.ColumnNames(Source), each _ <> Table.ColumnNames(#"Grouped Rows"){0})) in #"Expanded All Dynamic"
dufoq3
2 years agoCommunity Champion
Try this:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwMDQ0UdJRCijKTylNLlHIS8xNVVA2BIqYG5hbGpsBGc75RUWpQCnn0uKS/NzUIoi0W2ZeZnFGaooCTKeuglNpTrZSrA5xpganJufnpSQWVcLNJcZQMwxDjUCGGhobmRphdaoRdlMDEpOzE9NTU4g2mVjnYhpsjmGwMcxgY6xONqaSyaQ7ORYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"GOLD PL_PartMain [Part_No]" = _t, #"GOLD PL_PartMain [Part_Name]" = _t, #"GOLD PL_PartMain [Main_Part_Key]" = _t, #"GOLD PL_CommonCustomerPart [Customer_Name]" = _t, #"GOLD PL_PartMain [Part_Type]" = _t]),
#"Grouped Rows" = Table.Group(Source, {"GOLD PL_PartMain [Main_Part_Key]"}, {{"All", each Table.FirstN(_, 1)}}),
// This step expands every column except 1st column of prev. step "Grouped Rows" which is "GOLD PL_PartMain [Main_Part_Key]"
#"Expanded All Dynamic" = Table.ExpandTableColumn(#"Grouped Rows", "All", List.Select(Table.ColumnNames(Source), each _ <> Table.ColumnNames(#"Grouped Rows"){0}))
in
#"Expanded All Dynamic"