In my recent post on UK Postcode mappings for powerBI I showed how you can create a map for the UK Regions to display your data. In this post, we’ll go down a level and I’ll show you a mapping of individual postcode area to the UK Map.
First, we’ll need to enable a preview feature (as of publication) of powerBI called shape maps. To do this just head to the options and settings in powerBI and tick the “Shape map visual” box, then restart powerBI.

The shape map lets you use TopoJSON files to create custom maps, much like the synoptic designer custom visual from my previous post, in fact recreating the region map as a TopJSON might be a more elegant solution. For this map, I used a shape file from this company who have put together a data source for the postcode geometries. I converted this to a TopoJSON using mapshaper and loaded this up as a shape map. For the demo I’ve just assigned random numbers between 1 and 100 to each region, but as you can see the map looks great 🙂

They also had geometries for the individual postcode districts, meaning you can drill down even further (not exactly drill down like in Bing maps, as that feature isn’t part of the shape map vis yet). Here is the map of districts:

You can however filter down into individual postcode area’s, using the first map as a slider to filter the second map by creating a relationship between the two assignment tables. Create the relationship by adding a column in the district table and linking it to the area table:

Then you can click on regions of the area map to filter the down the district map to postcodes districts in that area. Try it out on the embedded report below:
For more information about postcode assignments and the other map visualisation in powerBI, see my previous post here. As always, if you have any questions feel free to comment and I’ll do my best to get back to you.
If you’d like to use the TopoJSON file for your own work, head over to Open Door Logistics downloads page, where the data came from. Dr Phil Welch has graciously agreed to host the files there for anyone to use internally, check out the license details here.
Ross Palmer
This is fantastic and has helped massively with producing some great visual for our sales teams. The one thing I am missing is a map that would also contain the Irish counties as our sales teams are split across the UK & Ireland. Do you know where I could obtain a TopoJSON file for this?
O Sin
Hi Ross, I had the same issue when I was looking for a good data source. Since the place I work doesnt do much business in NI I didn’t worry to much about that and left it as just the postcode area, BT, without districts.
I did find one good resource that uses the open source Ordnance Survey data here – https://martinjc.github.io/UK-GeoJSON/. There aren’t postcode districts but there are local government districits that could be useful for drill downs. Let me know if you find anything better, or if you can find an open source shapre file I can convert it to a topoJSON.
Keith
Thanks so much for sharing these via ODL – way better performance than Power BI’s filled map visual when it comes to postcode districts. It’s shame the District dataset doesn’t include NI postcode boundaries – anyone know a source for a JSON of the full UK?
Sarah
Hello, I’ve created a really similar map for local authorities and the districts within them. The one thing it’s missing is data labels. It seems that shape maps don’t really support them. Is there any way to show labels on the ‘zoomed in’ areas without hovering over them?
O Sin
Hi Sarah, unfortunately I dont know of a way to do that with the shape map at the moment. Since its an SVG you could add the visual labels to the file, but that would just be for the categories, rather than the values.
Mike Asplin
Hi Sarah. any chance of sharing your map as often need to use LAs and districts for mapping some of my work?
Mike Asplin
Sorry being a bit dim. i downloaded the files from ODL, but only way i could see to do this was cut and paste into notepad and then just name as .json file. is that correct? i loaded the area one up in power bi and seemed ot generate a map that looked like areas e.g. PL of PL3 1DQ. When I added my data which has relationships to a postcode area table i just got undefined on the map. I tried the district one and just got a map of the US.
Could you walk me through the steps from going to ODL to getting a result please? Looks brilliant
O Sin
Hi Mike, I’ll try to download the files and do a tutorial from that point later. Remind me if its not done this week!
Greg
Hi O Sin,
Did you ever get around to doing the tutorial? I’d be really keen to see how to do this!
Thanks for your work on this so far,
Cheers
Dale Jones
A tutorial would be marvellous. I’ve a novice at all this, so a step by step guide on what to do from the start to build a map view in Power BI would be great.
Matthew Shields
Hi, the tutorial is really good thanks for making it! The one part I’m struggling with is the step linking the generic areas produced to the correct post code. Could you expand on this step at all if you get a chance? Much appreciated!
O Sin
Hi Matthew, In your data you’ll need to add a new column with the postcode prefix (the part that matched the map data). You can then use this to link to the map visual.