One of the things I like about Power BI is, it supports geospatial visualizations. Map and Filled Map are built-in visualizations we can use if we need a visual with geographic coordinates. But it's not perfect, like everything else, it has some issues. I will explain the issue that I have faced and of course the solution to it.

On the map, I visualize sales by city and France is filtered. Despite France is filtered, it shows some cities in the USA. In the beginning, I didn't understand what caused it, but later I have noticed that both countries have cities with the same name and that's the reason for my problem. Somehow, Power BI can't decide which city I meant to see despite I filter by country and shows all the cities with the same name on the map.
The first solution is using latitude and longitude data, but of course, if you have it. I had that data and it solved my problem but I am also going to explain what to do if you don't have latitude and longitude data. Be patient guys.
First, I have changed my latitude and longitude columns' data category to latitude and longitude, and then I added those to my Map visual by using field pane.

It worked! I don't see cities in the USA anymore. But what if I hadn't had coordinates of the cities? For that scenario, I need to create a column that has both city and country names. My formula to create that column is this: City & Country = [City] & " " & [Country] Then I converted my new column's data type to Place at Data category section. After that, I added my new column to the location section at the field pane of the Map.
Voila! Now Power BI shows the cities only in France, which I intended to do from the beginning. If you have coordinate data, I recommend to use it without creating a new column so that you are not going to increase the size of your modal and slow it. I also used the performance analyzer to see which one works faster. The map with latitude and longitude data refreshed faster than the other one. So it's safe to say preferring coordinate data if it exists in the modal, is wiser than the other in this scenario.
Lastly, I'd like to share with you the option which works without coordinate information and creating a new column. I have created a hierarchy using cities and countries and used it on the visual. When I drilled down or expanded all down one level in the hierarchy, Power BI was able to match the cities correctly. But it created the same error when I used "Go to the next level in the hierarchy" option and it might be a little bit confusing for users. To avoid that confusion we can turn off "Go to the next level in the hierarchy" option from Visual headers.
Comments