Forum Discussion
TobyC84
Sep 16, 2021Copper Contributor
Power Query Replace Data Help Please (Tiime Sensitive)
Hey everyone! Here is my conundrum. I have a workbook with several columns and rows. I have a column for product SKUs and a column for Price, as well as a bunch of other info in "workbook A". I need ...
- Sep 16, 2021
Assuming SKU are unique in both tables, you may merge A with B, add custom column for corrected price (if null then oldPrice else newPrice) and do cosmetic
For such sample
generated script is
let Source = Table.NestedJoin( TableA, {"SKU"}, Table2, {"SKU"}, "Table2", JoinKind.LeftOuter ), #"Expanded Table2" = Table.ExpandTableColumn( Source, "Table2", {"Price"}, {"Price.1"} ), #"Added Custom" = Table.AddColumn( #"Expanded Table2", "Price Corrected", each if [Price.1] = null then [Price] else [Price.1]), #"Removed Other Columns" = Table.SelectColumns( #"Added Custom", {"SKU", "Price Corrected", "V"} ) in #"Removed Other Columns"
SergeiBaklan
Sep 16, 2021Diamond Contributor
Assuming SKU are unique in both tables, you may merge A with B, add custom column for corrected price (if null then oldPrice else newPrice) and do cosmetic
For such sample
generated script is
let
Source = Table.NestedJoin(
TableA, {"SKU"},
Table2, {"SKU"},
"Table2", JoinKind.LeftOuter
),
#"Expanded Table2" = Table.ExpandTableColumn(
Source,
"Table2",
{"Price"}, {"Price.1"}
),
#"Added Custom" = Table.AddColumn(
#"Expanded Table2",
"Price Corrected",
each
if [Price.1] = null
then [Price]
else [Price.1]),
#"Removed Other Columns" = Table.SelectColumns(
#"Added Custom",
{"SKU", "Price Corrected", "V"}
)
in
#"Removed Other Columns"
- TobyC84Sep 16, 2021Copper ContributorSergei, thanks for the response! I was able to sort it out because of your direction! Thank you sir!
- SergeiBaklanSep 16, 2021Diamond Contributor
TobyC84 , you are welcome, glad it helped