Forum Discussion

lcfaria's avatar
lcfaria
Helper II
2 years ago
Solved

Wrong map location with custom shape map

Hello everyone,

 

I need help from the community.

 

I'm working with a custom shape map of Panama and I'm having trouble plotting cities with the same name.

PS: You can find the link to the pbix file below.

 

What is happening is, when I try to plot the city of Las Lomas in the province of Coclé, the map also plots this city in the province of Chiriquí, since there is also a city called Las Lomas in that province.

 

This is my data, it includes information about the province and district:

PS: I put here just these two examples, but my data is bigger.

 

Here is the result I'm getting, Las Lomas (blue marked below) is appearing in two different places:

 

Does anyone have any idea how I can resolve this issue?

 

I've tried concatenating the province, district, and city, but it doesn't seem to work on the Shape Map.

 

Link to the file: https://1drv.ms/u/s!At5JlMR_naI1goRQKuhR_rfRYiZEhg?e=ZM6diU

  • If you 'View Map Type Key' in the shapemap options-> Format visual, you'll find a unique code in there on each row.

    You have to get that unique code in your data too, so that powerbi can work out how to link your data to the shapemap's keys.

    So find yourself a csv file of unique codes, provinces, districts, cities and use Power Query to merge that unique code into your data. It's best to make it a text field if I remember correctly.

    Once you've done that, put the code in the Location field well and powerbi should find the correct area.

2 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    If you 'View Map Type Key' in the shapemap options-> Format visual, you'll find a unique code in there on each row.

    You have to get that unique code in your data too, so that powerbi can work out how to link your data to the shapemap's keys.

    So find yourself a csv file of unique codes, provinces, districts, cities and use Power Query to merge that unique code into your data. It's best to make it a text field if I remember correctly.

    Once you've done that, put the code in the Location field well and powerbi should find the correct area.

    • lcfaria's avatar
      lcfaria
      Helper II

      Hi HotChilli 

       

      Thank you for your response.

       

      Yes, I noticed that, but unfortunately, there was no unique field, except for some automatically generated IDs.

       

      So basically, what I did was create a new attribute in QGIS where I concatenated province, district, and city. Then, I did the same in Power BI, and that solved the problem.

       

      But the logic was really about having a unique identifier in the Map Key.

       

      Thanks for your help.