Using Power Query and Power Map to visualize public data of the windmills in denmark
While preparing a training session for a customer within the Windmill industry I found public data that lists all the windmills in Denmark with their size and location.
The data can be found here – http://www.ens.dk/info/tal-kort/statistik-noegletal/oversigt-energisektoren/stamdataregister-vindmoller
So I decided to see what Power BI could do with this dataset.
The file with the latest data (http://www.ens.dk/sites/ens.dk/files/byggeri/anlaegprodtilnettet.xls is named the same way and is structured in a way that makes it easy to make custom analysis and visualisations.
So first tool to use in the Power BI stack…
Power Query to the rescue
First – switch to the Power Query tab and choose to load data from File and Excel File and paste the address to the file in the file open – it does take some time but it will work.
And Power Query will open and list the tables that exists in the file
The data we are interested in starts at row 18 and contains a lot of columns that we aren’t interested in.
And there is also some formatting of columns from text to numbers etc.
Here is the total list of steps shown
Create a Power Query function to create Latitude and Longitude
The data file has doesn’t contain Latitude or longitude but the coordinates is listed with the “European Terrestrial Reference System” – so I had to find a way to convert the values into Latitude and longitude.
The Danish Geodata Agency provides a free webservice that can do the conversion for us – http://geo.oiorest.dk/documentation/api/koordinat.aspx – examples.
So for instance the first wind mill is located at
And inspired by Rafael Salas – blog post – http://www.rafael-salas.com/2013/08/power-query-creating-function-to.html – I decided to create a Power Query function to do the calculation.
So I created a blank Query and added the following query
The function takes two arguments the east and north coordinates, and uses those coordinates to get and XML table from the Web service. As I run with a comma as decimal separator on due to my Danish regional settings I have to replace the comma with a dot as the web service requires the decimal separator to be a dot.
The result is loaded into a table with the “bredde” – latitude and “Længde” – longitude
And the function returns both of these columns.
Then I can use that function in my first query by adding a Custom Column.
And expand that to get both latitude and longitude as columns in my query.
And voila the custom calculated columns.
Then some number formatting of some columns and renaming to English heading and we are ready to send the data to Excel
The data back in Excel
Returning the query to Excel will then give me the list of all 5.126 running windmills in Denmark per September 2013.
Pretty awesome – it does take about 2-3 minutes for it to update/lookup all the geo location – but only one isn’t matched and that is due to an empty row.
Using Power Map to visualize the data
With the data nicely washed and geotagged we can use Power Map to visualize the data.
Power Map’s first guess on the geomapping is actually very good. The “Kommune” is set to county – which is correct and because I named the columns Latitude and Longitude these are automatically also linked correct.
With the Geography properly matched we can move “Next” to visualize the data.
So for instance the KWH by Supplier
Or the KWH by Region/County
Or the world biggest sea wind mill park
Or a heatmap
This is so much fun and finally let make a video of the development over time.
Power map video
Power map also enables us to create a timeline and play the timeline. The data has the date of when the windmill was established so we can use that date to visualize how the windmills have evolved over time.
So by adding the established field to the Timeline – power map can visualize the development over time.
This can be created as a video.
Creating the 45 sec video at the medium format took about 10 minutes to create – so be patient.
Here is a link to the video – http://sdrv.ms/17cBIrx
You can download the example file – here
You are more than welcome to add a comment whether you find this cool or not J