Forum Discussion
Compare and replace values in column from another table
Hi,
I have a table (TableA) with these columns
| Province | District | City |
| Arovia | Eastwood | Willobrook |
| Arovia | Northside | Pynville |
| Belloria | Greenridge | |
| Belloria | Westfield | Mapelwood |
| Cordovia |
I manually created another query table (TableB) with the below
| Province | District | City |
| Arovia | Eastwood | Willowbrook |
| Arovia | Northside | Pineville |
| Belloria | Greenridge | Oaksville |
| Belloria | Westfield | Maplewood |
| Cordovia | Riverside | Cedarville |
I would like to compare the City columns in TableA with TableB, and return or replace the values in TableA that match the closest, with values from TableB, in a new separate column.
For example, in TableA column, there are some City names misspelt, and some District and Province names wrongly listed as City.
How do i fix this problem using M query ?
Once fixed, TableA will eventually have a new column NewCity like below
| Province | District | City | NewCity |
| Arovia | Eastwood | Willobrook | Willowbrook |
| Arovia | Northside | Pynville | Pineville |
| Belloria | Greenridge | Oaksville | |
| Belloria | Westfield | Mapelwood | Maplewood |
| Cordovia | Cedarville |
Thanks in advance !
2 Replies
- amitchandakSuper User
Anonymous , Try out if this function can help
Power Query Table.AddFuzzyClusterColumn: https://youtu.be/osF1z5kgvMo
- AnonymousNot applicable
thanks but its still not exactly what i want it to achieve.
it doesnt call the correct values from TableB. The only other thing i can think of using the Table.AddFuzzyClusterColumn is to create a separate Transformation Table (TT), but that defeats the purpose, because that would require me to manually enter the data to match it accordingly in the TT.Also, Table.AddFuzzyClusterColumn is not able to differentiate between City, District and Province. Some Province and District values are in the wrong column.