Tips and tricks for Power BI map visualizations
APPLIES TO: ✔️ Power BI Desktop ✔️ Power BI service
Power BI integrates with Bing Maps to provide default map coordinates (a process called geo-coding) so you can create maps. Together they use algorithms to identify the correct location, but sometimes it's a best guess. If Power BI tries, but can't create the map visualization on its own, it enlists the help of Bing Maps. Read more in Bing Maps Documentation.
To increase the likelihood of correct geo-coding, use the following tips. The first set of tips is for you to use if you have access to the dataset itself. The second set of tips is things you can do in Power BI if you don't have access to the dataset.
What is sent to Bing Maps?
The Power BI service and Power BI Desktop send Bing the geo data it needs to create the map visualization. This may include the data in the Location, Latitude, and Longitude buckets of the visual's field well. Exactly what is sent varies by map type. To learn more, see Bing Maps privacy.
For maps (bubble, scatter, and dot plot maps), if latitude and longitude are provided, then no data is sent to Bing. Otherwise, any data in the Location bucket is sent to Bing.
Filled maps require a field in the Location bucket; even if latitude and longitude are provided. Whatever data is in the Location, Latitude, or Longitude bucket is sent to Bing.
In the example below, the field PostalCode is being used for geo-coding, so the values in the PostalCode column are sent to Bing. Data from the Size bucket is not sent to Bing.
In this second example below, the field Territory is being used for geo-coding, so the values in the Territory column are sent to Bing. Data from the Legend bucket (and the Color saturation bucket when you use a Shape Map in Power BI Desktop) is not sent to Bing.
In the dataset: tips to improve the underlying dataset
If you have access to the dataset that is being used to create the map visualization, there are a few things you can do to increase the likelihood of correct geo-coding.
1. Categorize geographic fields in Power BI Desktop
In Power BI Desktop, you can ensure fields are correctly geo-coded by setting the Data Category on the data fields. In Data view, select the desired column. From the ribbon, select the Column tools tab and then set the Data Category to Address, City, Continent, Country, County, Postal Code, State, or Province.
These data categories help Bing correctly encode the data. To learn more, see Data categorization in Power BI Desktop. If you are live connecting to SQL Server Analysis Services, you will need to set the data categorization outside of Power BI using SQL Server Data Tools (SSDT).
2. Use more than one location column
Sometimes, even setting the data categories for mapping isn't enough for Bing to correctly guess your intent. Some designations are ambiguous because the location exists in multiple countries or regions. For example, there's a Southampton in England, Pennsylvania, and New York.
Power BI uses Bing's unstructured URL template service to get the latitude and longitude coordinates based on a set of address values for any country. If your data doesn't contain enough location data, add those columns and categorize them appropriately.
For example, if you only have a City column, Bing may have a hard time geo-coding. Add other geo columns to make the location unambiguous. Sometimes all it takes is adding one more location column to the dataset - in this case state/province. And don't forget to categorize it properly, see #1 above.
Make sure each field only has a single location category. For example, your City location field should be Southampton, not Southampton, New York. And Address location fields should be 1 Microsoft Way and not 1 Microsoft Way, Redmond, WA.
3. Use specific Latitude and Longitude
Add latitude and longitude values to your dataset. This removes any ambiguity and returns results more quickly. Latitude and Longitude fields must be in Decimal Number format, which you can set in the data model.
This video might use earlier versions of Power BI Desktop or the Power BI service.
4. Use Place category for columns with full location information
While we encourage you to use geo-hierarchies in your maps, if you must use a single location column with full geographical information, you can set the data categorization to Place. For example, if the data in your column is full addresses, such as 1 Microsoft Way, Redmond Washington 98052, this generalized data category will work best with Bing.
In Power BI: tips to get better results when using map visualizations
1. Use latitude and longitude fields (if they exist)
In Power BI, if the dataset you are using has fields for longitude and latitude--use them! Power BI has special buckets to help make the map data unambiguous. Just drag the field that contains your latitude data into the Visualizations > Latitude area. And do the same for your longitude data. When you do this, you also need to fill the Location field when creating your visualizations. Otherwise, the data is aggregated by default, so for example, the latitude and longitude would be paired at the state level, not the city level.
Use geo-hierarchies so you can drill down to different "levels" of location
When your dataset already has different levels of location data, you and your colleagues can use Power BI to create geo-hierarchies. To do this, drag more than one field into the Location bucket. Used together in this way, the fields become a geo-hierarchy. In the example below we have added geo fields for: Country/Region, State, and City. In Power BI you and your colleagues can drill up and down using this geo-hierarchy.
When drilling with geo-hierarchies, it is important to know how each drill button works and what gets sent to Bing Maps.
- The drill button on the far right, called Drill Mode , allows you to select a map Location and drill down into that specific location one level at a time. For example, if you turn on the drill-down option and select North America, you move down in the hierarchy to the next level -- states in North America. For geo-coding, Power BI sends Bing Maps country and state data for North America only.
- On the left, there are two other drill options. The first option, , drills to the next level of the hierarchy for all locations at once. For example, if you are currently looking at countries and then use this option to move to the next level, states, Power BI displays state data for all countries. For geo-coding, Power BI sends Bing Maps state data (no country data) for all locations. This option is useful if each level of your hierarchy is unrelated to the level above it.
- The second option, , is similar to the drill-down option, except that you don't need to click on the map. It expands down to the next level of the hierarchy remembering the current level's context. For example, if you are currently looking at countries and select this icon, you move down in the hierarchy to the next level--states. For geo-coding, Power BI sends data for each state and its corresponding country to help Bing Maps geocode more accurately. In most maps, you will use either this option or the drill down option on the far right, so you can send Bing as much information as possible to get accurate location information.
More questions? Try the Power BI Community
Submit and view feedback for