Forum Discussion

MojoGene's avatar
MojoGene
Post Patron
6 years ago
Solved

Replace value and move to different column?

M code newbie question: I am trying to move the values in the "Country/Region" column into into the "Province/State" column and replace the moved value in Country/Region with a region name, e.g., "Eu...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    MojoGene 

     

    Right, there is no magic bullet for that. What I did was take the values in your Country/Region table and copied them. I pasted these into a new Enter Data query called Table. I then added a column for Region and put values in there for the region. Now, I got lazy and because I am from the US my geography skills suck so there are a lot of Europe's in there. Just click the gear icon next to the Source step and correct all that to what you want. It's manual, but you only have to do it once.

     

    Now, I then added a Merge Queries step to the COVID-19 table that merges this new Table into the COVID-19 table so that you now have the desired Region column. Updated PBIX is attached.