The tutorial continues with retrieving country IDs from the UN Data API to get population forecasts.
Files for this lesson:
Download all course files here. (You need to login to see the files)
In this lesson you will use:
- Sources.txt
- UN Data.pbix
About this lesson:
Here’s a summary of the video content:
- Overview:
- The tutorial continues with retrieving country IDs from the UN Data API to get population forecasts.
- Getting Country IDs:
- The API URL for locations is
population.un.org/api/locations
. - This URL retrieves location IDs for all countries, which will later be filtered for specific regions (e.g., European Union).
- The API URL for locations is
- Using Power BI:
- The tutorial uses Power BI to perform a web query with the provided URL.
- Power BI fetches data in JSON format, converting it into a table and expanding the data.
- Handling Pagination:
- The API returns data in pages, with the first page containing 100 records.
- To retrieve all records, the tutorial demonstrates how to handle pagination by appending a page number parameter to the URL.
- Creating a List of Pages:
- The tutorial shows how to create a list in Power BI to iterate through all available pages.
- A dynamic list is created based on the total number of pages.
- Custom Columns for Page Numbers:
- A custom column is created in Power BI to modify the URL for each page number.
- The tutorial details converting numbers to text format for URL compatibility.
- Combining Data:
- Data from all pages is combined into a single table.
- The tutorial filters out unnecessary columns, keeping only the IDs and names of the countries.
- Next Steps:
- The next module will involve retrieving a list of European Union countries through web scraping.
- The final objective is to filter the location data to focus on these countries.
The tutorial provides a step-by-step guide on accessing and handling paginated API data using Power BI, with a focus on UN population data.
Was this helpful?