Forum Discussion

MyWeeLola's avatar
MyWeeLola
Helper II
1 year ago
Solved

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

 

 

EngIdFnameLnameEmailAColBcol
1ANother[email protected]DataMore data
2BAlpha[email protected]DataMore data
3Cbeta[email protected]DataMore data
4DAlpha[email protected]DataMore data
5Ebeta[email protected]DataMore data
6FAlpha[email protected]DataMore data
7Gbeta[email protected]DataMore data
8HAlpha[email protected]DataMore data
9Ibeta[email protected]DataMore data

 

The correction table looks like this

 

EngIdFnameLnameEmail
4NewFNewS[email protected]
6BAlpha[email protected]
8BAlpha[email protected]
9ANother[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

  • SamWiseOwl 

     

    Seems simple when you put it like that:) Thank you very much and I appreciate you taking the time to show me.

     

    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: