Data.World – Get Dataset

Power Query is a powerful data transformation and data preparation tool that enables users to discover, access, and transform data from various sources. It is a part of the Microsoft Power BI suite, which allows users to connect to multiple data sources and create visually appealing and interactive reports.

Data.World - Get Dataset

One of the data sources that Power Query can connect to is [Data.World](https://data.world/), which is a platform for hosting and sharing datasets. In this article, we will discuss how to use Power Query M Language code to connect to the Data.World platform from within Power BI to get dataset data sources.

What is Power Query M Language?

Power Query M Language is a functional programming language designed to work with Power Query. It allows users to create custom functions, manipulate data, and perform advanced data transformations. M Language is used to create queries in Power Query, which are used to extract, transform, and load data from various sources.

Connecting to Data.World

To connect to Data.World from within Power BI, we need to use the Web.Contents() function in M Language. This function allows us to send an HTTP request to a web server and retrieve the response.

Step 1: Get the Data.World API Key

Before we can connect to Data.World, we need to get an API Key. To get an API Key, we need to create a free account on Data.World and create a new project. Once we have created a new project, we can generate an API Key by going to the project’s settings and clicking on the “Generate new token” button.

Step 2: Create a New Query

Data.World - Get Dataset

To create a new query, we need to go to the Power Query Editor in Power BI and click on the “New Source” button. From the drop-down menu, we need to select “Blank Query.”

Step 3: Write the M Language Code

To connect to Data.World, we need to write the following M Language code:


let

apiKey = “INSERT_API_KEY_HERE”,

url = “https://api.data.world/v0/sql/YOUR_DATASET_QUERY_HERE”,

options = [

Headers = [

#”Authorization” = “Bearer ” & apiKey,

#”Accept” = “application/json”

]

],

source = Json.Document(Web.Contents(url, options))

in

source


In this code, we are first declaring a variable called “apiKey” and assigning it the Data.World API Key that we generated in Step 1. We are then declaring a variable called “url” and assigning it the URL for the dataset query that we want to retrieve.

Next, we are creating a variable called “options” and assigning it an array of headers that we want to include in the HTTP request. These headers include the Authorization header, which includes our API Key, and the Accept header, which specifies that we want to receive the response in JSON format.

Finally, we are using the Web.Contents() function to send an HTTP request to the Data.World server with the URL and options that we have specified. We are then using the Json.Document() function to convert the response to a JSON format, which we can use in our Power Query.

Step 4: Load the Query

Once we have written the M Language code, we can click on the “Close & Apply” button to save the query and return to the Power BI report. We can then use the dataset data source that we have retrieved in our report by clicking on the “Load” button.

Conclusion

Power Query is a powerful tool that allows us to transform and prepare data from various sources. By using M Language code, we can connect to the Data.World platform from within Power BI and retrieve dataset data sources. This enables us to create visually appealing and interactive reports that are based on accurate and up-to-date data.

Power BI Training Courses by G Com Solutions (0800 998 9248)

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)

    Similar Posts