Forum Discussion

utsavpatel's avatar
utsavpatel
Microsoft Employee
5 years ago
Solved

Country Code to Country Name

I have a column called Country (US,IN) with 2 letter country code and what I need is another column that has country name in it. I prefer Powerbi inbuilt functionality rather than downloading a new mapping code to name file from open source.

  • Hi utsavpatel ,

     

    There is no in-built functionality in Power BI that by-default creates a column with country name for you against these country codes.

    1. You can create a calculated column which assigns a country name value against these country codes. But this may not be appropriate as you may have multiple country codes in your data. If there are like just for example 5 country codes then you can use this method.
    2. Download a country code mapping from some web source which has country names against these codes.

    Also, what you are trying to achieve with this country code and country name in Power BI will help in understanding what a proper solution could be.

    For example, if you want to create a map visual, then Power BI does recognises country codes on it. But still more details on this will be helpful.

     

    Thanks,

    Pragati

4 Replies

  • Hi utsavpatel ,

     

    There is no in-built functionality in Power BI that by-default creates a column with country name for you against these country codes.

    1. You can create a calculated column which assigns a country name value against these country codes. But this may not be appropriate as you may have multiple country codes in your data. If there are like just for example 5 country codes then you can use this method.
    2. Download a country code mapping from some web source which has country names against these codes.

    Also, what you are trying to achieve with this country code and country name in Power BI will help in understanding what a proper solution could be.

    For example, if you want to create a map visual, then Power BI does recognises country codes on it. But still more details on this will be helpful.

     

    Thanks,

    Pragati

  • Anonymous's avatar
    Anonymous
    Not applicable

    So I just opened the raw data file in excel and changed the country code column to a geography data type and inserted a new column that referenced the country code column then just put .name example =B2.Name. Then just copied and pasted the values and changed the country code column back to a text field and saved and closed. Then you could just use that as another data source.