Custom Shape Map in Power BI


Maps are excellent chart choices for presenting geographic information as they overlay the numerical data on top of the geo-coordinates of the places. This makes the report user see an important dimension of the data that other common substitute charts like bar, column, line, pie and treemap cannot depict: the relative location of the places. Custom Shape Map in PowerBI have so many capability.

The Power BI Shape Map is used to compare regions on a map by coloring them differently. The region with higher values has a thicker color variance. Unlike other map visuals the Custom Shape Map in Power BI can be used to present custom-designed maps that do not follow the general map shapes and labels.

For this project, we would be using a Custom Shape Map in Power BIcustom shape map to show the value of census data carried out in all the regions of Nigeria for 1991-11-26, 2006-03-21 and 2016-03-21

For the demonstration of Shape Map, I will follow the steps from a blog post written by David Eldersveld where he accessed the TopoJSON files for different countries for use within the Shape Map.

Requirements and availability

Our readers should have a basic understanding of Power BI Desktop and Power BI Services (web) to get the most out of this tutorial.

Power BI Shape Map

Step 1: Activate Shape Map

The Power BI shape map is available as a preview feature in the Power BI Desktop, it must be enabled before it can be used.

To enable, select File > Options and Settings > Options > Preview Features, then select the Shape map visual checkbox. Click “OK”.

You’ll need to restart your Power BI Desktop.

As soon as you restart your Power BI Desktop you will notice on the Visualizations pane the Shape Map visual appearing.

Step 2: Create a Shape Map

Click on the Shape Map icon on your visualization pane, a chart will appear on the Power BI canvas.

On the Field Pane, you drag the State to Location and the Revenue to the Color Saturation. In the canvas, you will notice the map of the USA appearing which is just a default map and we have to change it.

The data used for the Project is the census data of Nigeria obtained from the City Population website. We have to set the Shape Map to recognize our downloaded map coordinates.

Click on the Format tab in the Visualization pane. Then click Shape, you’ll notice the default Shape Map “USA: states”. If you click on the dropdown beside the USA, you’ll see other countries. Unfortunately, the country we want is not available in the dropdown.

Custom Shape Map

Step 3: Get the Nigeria Census Data

For this project, we would be using the Nigeria census data for 1991-11-26, 2006-03-21, and 2016-03-21. This data can be found on the CITY POPULATION website.

To import the data we would be using the web scraping feature in Google Sheet. It’s a fun and cool formula-based feature.

The IMPORTHTML function would be used:

  • Get the website URL you want to scrap your data from.
  • Use the import HTML function IMPORTHTML(“URL”,”table”,1).
  • The “Table” indicates you want to import tabular data from the website.
  • 1 indicate that we want to import the first table.
  • Then from Power BI Desktop using the Get Data from “Google Sheet” to connect.
Custom Shape Map

Step 4: Get TopoJSON files

By following the steps provided below we would create a TopoJSON file.

The TopoJSON custom shape map visual can be accessed by clicking on this GitHub link.

Select the country you want to use for this project. We would be using the Nigeria Shape map, after that select Nigeria-regions.json.

Right-click on the raw icon and select save as to download the TopoJSON file.

Custom Shape Map

Back to the Power BI visualization pane 

Step 5: Add Custom Map 

From Format > Shape > Add map

Start by adding values inside the field of your PowerBI Desktop

When you click on the Add Map, it prompts the directory window, which you are expected to locate the directory in which you downloaded the  nigeria-regions.json. Select and then open the file on Power BI Desktop.

After selecting the nigeria-regions.json you will notice the shape map visual instantly changes to Nigeria map. 

STEP 6: Publish to Power BI Service

Power BI service is the Software as a Service (SaaS) part of Power BI. It is also known as Power BI Online. To access Power BI Service, you need to log in to Power BI service

Custom Shape Map

Access the Report on this link:

Other Relating topics:


Leave a Reply