Sales Prediction Model in Power PI
Leveraging the Python Scripting option in Power BI is a powerful way to build complex machine learning models with the interactive of a dashboard.
For the Python model, the SciKit Learn library to create a Linear Regression model that will have a training and testing set for the model to learn on. Then we will run the model on the total dataset.
We can derive the coefficients and rebuild the linear regression equation using WhatIf parameters in Power BI.
TV  radio  newspaper  sales 
23.01  37.8  69.2  27183 
4.45  39.3  45.1  12792 

This is a sample of the data set that is going to be used.
In the data above we will be using Sales as our predictor and the 3 channels will make up of our coefficients.
When building your code, its best to use an IDE which will give you the ability to decode the Python script. Spyder is a good lightweight IDE that come with the Anaconda
Please review the video and the code below. Feel free to ask questions in the comment section below.
Can you please attach the sample dataset in CSV format.