ML model in PBI

Hi Readers , have you ever wondered on how to run a Machine learning Model (in python) in Powerbi application? This Blog will help you with it.
Before Implementing it you need to have a ML model in python code ready. In my case, I have ML model that predicts the Profit value of 50 startup companies based on features like  ‘R&D Spend’, ‘Administration’, ‘Marketing Spend’ and State .

1) First import your dataset in fresh Power Bi file.
In Power BI Desktop, select File > Options and settings > Options .

2)Then select  Global > Python scripting. Set Python home directory 

NOTE – If your normal python is not working here then Download last version of Winpython from :

3) Go to Transform data and open Power query editor and select transform and then click Run Python Script.

4) Paste the python code in it and run.

5) Do the necessary transformation as required in your dataset.

6) Here as you can see the prediction  column is generated.

7) Now Close and Apply.

I hope that you will find this blog helpful

Karthik Ramanathan
Data Analyst
Addend Analytics

Addend Analytics is a Microsoft Power BI-partner based in Mumbai, India. Apart from being authorized for Power BI implementations, Addend has successfully executed Power BI projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia. Get a free consultation now by emailing us at