Consume Azure Machine Learning Model in Power BI

Tarash Jain
4 min readApr 7, 2023

--

Introduction

Machine learning models are powerful tools that can be used to derive insights and make predictions from complex data sets. Power BI, a business intelligence platform by Microsoft, allows users to integrate machine learning models directly into their reports and dashboards. In this blog, we will explore two methods of using machine learning models in Power BI, depending on whether you have a premium or pro license.

Before we dive into the implementation, let’s first understand what machine learning is and how it can benefit businesses. Machine learning is a subset of artificial intelligence that involves building algorithms that can learn from data and make predictions or decisions based on that data. By analyzing data patterns, machine learning models can provide insights that can help businesses make informed decisions, optimize processes, and improve outcomes.

Image by ”https://www.freepik.com/free-vector/modern-dashboard-element-collection_6188915.htm#query=power%20bi&position=12&from_view=search&track=ais

Implementation

Option 1

Using In-Built Tool in Power Query Editor (Premium License): If you have a premium license, you can use the in-built tool in Power Query Editor to select the machine learning model that you built in Azure Machine Learning Studio.

Follow the below steps:

Step 1: Create a new query in Power BI by selecting ‘Get Data’ from the Home tab and selecting the appropriate data source.

Step 2: Select the ‘Azure Machine Learning’ option from the Home tab.

Step 3: Choose the machine learning model you want to use from Azure Machine Learning Studio. Power Query populates the columns automatically for you.

The selected machine learning model will now be applied to the data and the output will be displayed in the query editor. You can then use this output to create charts, tables, and other visualizations in Power BI.

Option 2

Using API Key and URL (Pro License): If you have a pro license, you can use your own machine learning model by following the below steps:

Step 1: Obtain the API key and URL from Azure Machine Learning Studio for your machine learning model.

Step 2: Create parameters in Power BI for all the columns that are in your training dataset. Make sure all the parameters are Text type.

Step 3: Write a function in Power Query Editor that calls the machine learning model API and passes the input data as a parameter.
Here is an example of the function code that you can use:

Once the function is written, you can use it to call your machine learning model and display the output in your Power BI reports and dashboards.

Step 4: Go to the query where you have the data in which you want to run the prediction. Invoke the function and map the data to the parameter used in the function. Make sure that all the columns are Text type.

Conclusion

Using machine learning models in Power BI can help businesses derive insights and make informed decisions based on complex data sets. Depending on your license, you can either use the in-built tool in Power Query Editor or write a custom function to call your own machine learning model API. With the ability to integrate machine learning models into Power BI, businesses can gain a competitive edge by making data-driven decisions that lead to better outcomes.

--

--

Tarash Jain
Tarash Jain

No responses yet