Data Training from Zomalex

Home | Power BI | Excel | Python | SQL | Visualising Data | Generative AI

UK Election Dataset

This case study is used in lab exercises to build maps. The data relates to the UK 2024 election results.

There are several datasets. The HoC-GE2024-results-by-constituency.xlsx spreadsheet contains the election result data by constituency and is from the House of Commons Library here. The data is in an Excel table named HCGE2024Constituency. This dataset also has the geographical hierarchy of consituencies (by country, region). Location

The shape file, Constituencies_Boundaries_UK_BSC.zip, is from the UK Geoportal here This contains all the shapes of each of the constituencies. Download from here.

The Excel file, Constituencies_Boundaries_UK_BSC.xlsx, is also from the UK Geoportal. It contains a table with a row for each constituency with geographical information including the latitude and longitude of the central point of each. Location

The Excel file, party-lookup.xlsx, contains an Excel table named Party that maps the party name / abbreviation to the official party colour (which we use to colour the areas of the map). The party names match those in the election results data. Location

Suggested Approach (Power BI Labs)

Import the election result data into Power BI’s Query Editor.

Import the constituency boundaries data and merge with the election result data to add the latitude and longitude columns to that query.

Import the election lookup data and merge with the election result data to add the Party Colour column to that query.

Create two measures:

Create several maps

Add other visual to to the page e.g.

and use these to provide interactivity to filter the map in various ways.

Note that if you use the ‘Constituency name’ as the map location, there is a problem with one constituency, Montgomeryshire and Glyndwr. This is more evident on the area map. Can you find out what the problem is and fix it?

Notice that there is an issue that the auto-zoom does not seem to work so you can fix the zoom to 54 Latitutude, 0 longitude roughly, the centre of the UK.