This document provides instructions for connecting to the NOMIS API in Power BI to automatically update data when refreshed. It describes using the NOMIS website to build queries and copy the query URL. In Power BI, the URL is pasted as a web data source and transformations are applied, including removing date parameters, selecting required columns, pivoting measures, and renaming columns. Queries to the NOMIS API will return the latest data on refresh, though the query may temporarily fail if NOMIS is updating the API data.
call girls in Punjabi Bagh DELHI 🔝 >༒9540349809 🔝 genuine Escort Service 🔝✔️✔️
Connecting to the NOMIS API in PowerBI
1. Public Health & Communities Analytics | Suffolk County Council | Version 1.2 (September 2023)
phc_analytics@suffolk.gov.uk
Connecting to the NOMIS API in Power BI
Introduction
Using the NOMIS API allows data to be updated automatically when the dataset is refreshed
in the Power BI Service or Power BI Desktop. The method described in this guide was initially
created with assistance from colleagues at Norfolk County Council.
Using the NOMIS website to get queries
Queries are compiled using the NOMIS website. This allows you to select variables of
interest and set parameters for data to download. Once you have made your selections,
choose the NOMIS API data format.
Click Download Data. From this screen, right-click on Link (data.csv) and copy this link.
2. Public Health & Communities Analytics | Suffolk County Council | Version 1.2 (September 2023)
phc_analytics@suffolk.gov.uk
This link will be used as a query in Power BI Desktop to connect to the API. No API key is
required.
Using NOMIS queries in Power BI
In Power BI desktop, click ‘Get data’ then select the ‘Web’ source. Paste the copied URL (this
is known as the Query to the API) from the NOMIS website and click OK. Click Transform
data from the Preview window.
Once the query has been added, you may wish to use the formula bar or advanced editor to
remove the date parameter. This means your query will return data for all available dates.
To use Advanced Editor, click on the Home tab, then Advanced Editor.
Remove the part of the query that contains the word date. Delete everything from the start
of the word ‘date’ to the following ampersand (&). For example, in the query below, the text
highlighted in red would be deleted.
https://www.nomisweb.co.uk/api/v01/dataset/NM_17_5.data.csv?geography=1853882369
...1853882372,1853882374...1853882379&date=latest&variable=18,45,248,249,84,83,111,1
3. Public Health & Communities Analytics | Suffolk County Council | Version 1.2 (September 2023)
phc_analytics@suffolk.gov.uk
487,1488,27,54,250,251,93,92,120,1489,1490,36,63,252,253,102,101,129,1491,1492,1532..
.1540,594,820,841,290,720...722,335,344&measures=20599,21001,21002,21003
If asked which credentials to use for this data source, select Anonymous credentials and
Public privacy level.
Transforming data for use in the report
To use the data to build reports in Power BI Desktop, transformations will need to be
applied. From the Transform tab, select Use first row as headers. Now that each column is
correctly labelled, only keep the columns that are required. This is good practice as it
reduces the size of the dataset. From the Home tab, click Choose Columns. The columns
that will usually be required are:
• DATE
• DATE_NAME
• GEOGRAPHY_NAME
• GEOGRAPHY_CODE
• GEOGRAPHY_TYPE
• VARIABLE_NAME
• VARIABLE_SORTORDER
• MEASURES_NAME
• OBS_VALUE
Next, pivot the MEASURES_NAME column to obtain a separate column for each measure.
That is, a column for the numerator, denominator and percentage (where applicable). Click
the MEASURES_NAME column, then click Pivot Column from the Transform tab. The values
column is OBS_VALUE. Under the Advanced options, select Don’t Aggregate for the
Aggregate Value Function.
4. Public Health & Communities Analytics | Suffolk County Council | Version 1.2 (September 2023)
phc_analytics@suffolk.gov.uk
The MEASURES_NAME and OBS_VALUE columns of the table should have been replaced by
columns in the format below:
Further recommended transformations on this data (not detailed here) are:
• Renaming columns as appropriate.
• Changing data types for each column as appropriate.
• Dividing values in the Variable column by 100 to get data as a percentage.
Refreshing data
Queries to the NOMIS API will return the latest available data whenever they are refreshed.
This can include scheduled dataset refreshes in the Power BI service. When NOMIS are
updating the data in the API, the query will fail and any Power BI dataset including a query
to the NOMIS API refreshed during this period will fail. This is usually a temporary issue that
will be automatically resolved once NOMIS have finished updating the data in the API.
More information
https://www.nomisweb.co.uk/api/v01/help