Forum Discussion
How to use a seperate table to fix incorrect data
Good morning
I have a table which contains data from a read only sql database.
I have learned that some of the data is incorrect, however i cannot access the main database, therefore i wish to correct it using powerquery.
The main table data looks like this
| EngId | Fname | Lname | ACol | Bcol | |
| 1 | A | Nother | [email protected] | Data | More data |
| 2 | B | Alpha | [email protected] | Data | More data |
| 3 | C | beta | [email protected] | Data | More data |
| 4 | D | Alpha | [email protected] | Data | More data |
| 5 | E | beta | [email protected] | Data | More data |
| 6 | F | Alpha | [email protected] | Data | More data |
| 7 | G | beta | [email protected] | Data | More data |
| 8 | H | Alpha | [email protected] | Data | More data |
| 9 | I | beta | [email protected] | Data | More data |
The correction table looks like this
| EngId | Fname | Lname | |
| 4 | NewF | NewS | [email protected] |
| 6 | B | Alpha | [email protected] |
| 8 | B | Alpha | [email protected] |
| 9 | A | Nother | [email protected] |
Using PowerQ i want to update the main table using the correction table. The correction table will reach about 30 entries, so not horrendous if i have to use code to replace each entry, however I suspect there is an easier way using relationships or code etc. The EngId only contains unique values.
In the example, the original values for EngID 4 are D,Alpha, [email protected]. i want this replaced with the correction value of NewF,News,[email protected]
I appreciate any help.
Lola
Hi MyWeeLola
You can use the Merge option on the Home tab
Click the two columns that overlap, you can even join on multiple columns.
Choose the Expand option and tick the columns to bring through
Finally add a column that returns the correct value if there is one.
Then delete the unneeded columns:
2 Replies
- MyWeeLolaHelper II
Seems simple when you put it like that:) Thank you very much and I appreciate you taking the time to show me.
Lola
- SamWiseOwlSuper User
Hi MyWeeLola
You can use the Merge option on the Home tab
Click the two columns that overlap, you can even join on multiple columns.
Choose the Expand option and tick the columns to bring through
Finally add a column that returns the correct value if there is one.
Then delete the unneeded columns: