Forum Discussion
adoster
4 years agoResolver I
Replace Values from one table to another
Hi! Created a simple version of what I am trying to do. I have 2 tables. Relationship on column ID. Want to replace "Code" values in main SQL_TableA with values from imported Excel_TableB when the...
- Anonymous4 years ago
Hi adoster ,
In Power Query:
let Source = Table.NestedJoin(#"SQL_Table A", {"ID"}, Excel_TableB, {"ID"}, "Excel_TableB", JoinKind.FullOuter), #"Expanded Excel_TableB" = Table.ExpandTableColumn(Source, "Excel_TableB", {"ID", "Code"}, {"Excel_TableB.ID", "Excel_TableB.Code"}), #"Added Custom" = Table.AddColumn(#"Expanded Excel_TableB", "Custom", each if [Code] = "Error" then [Excel_TableB.Code] else [Code]), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Code", "Excel_TableB.ID", "Excel_TableB.Code"}) in #"Removed Columns"Use DAX:
Column = IF ( 'SQL_Table A'[Code] = "Error", LOOKUPVALUE ( Excel_TableB[Code], Excel_TableB[ID], 'SQL_Table A'[ID] ), 'SQL_Table A'[Code] )Best Regards,
Jay
mh2587
4 years agoSuper User
Append both the tables with coulmn ID