Linear Regression In Power BI

Introduction

In this article, you will see how to perform linear regression in Power BI. Linear regression is an extremely valuable measure that helps us to understand the connection among variables and the impacts they have on one another. It can be used across many industries in a variety of ways, from spurring value to acquiring client understanding in order to profit businesses.

The Simple Linear Regression model permits us to sum up and look at the relationship between two variables. To find linear regression, there will be an independent variable and a dependent variable. It uses it to find a linear function that predicts the dependent variable values as a function of the independent variables.

In a previous article, I have shown you how to find the ‘correlation coefficient’ that is used to determine the relation between two variables. See that article here.

The value of the correlation coefficient lies between 1 to 1. Negative means if X increases, Y decreases, or positive means If X increases, Y increases.

To perform linear regression, follow the below steps.

Step 1. To show linear regression, I used sales data. I have imported my table from the SQL server. I have written a separate article on how to import data from an SQL server.

SQL server

Step 2. Our second step will be creating a scatter plot. You can find a scatter plot in the visualization panel. Click on it and fields into it. I am using the month of the ‘ModifiedDate’ column, ‘OrderQty’ on X-axis, and ‘UnitPrice’ on Y-axis.

UnitPrice

Step 3. Now, I am going to add a trend line to it. To add a trend line go to the ‘Analytics’ tab below the visualization click on ‘Trend line’ again and click on ‘Add’. Rename the line, and select any color and style for the line. A line will be added to the scatter plot.

Analytics

This line shows the correlation between two values, and it is positive. We can also add a correlation coefficient in this report to check it. I have already written a separate article on ‘Correlation coefficient’. Add a quick measure and click on ‘correlation coefficient’. Select the same fields that we have used for linear regression.

Correlation coefficient

Select ‘Card’ visualization to show the value of the ‘correlation coefficient’.

Card

Summary

Linear Regression is helpful for a wide assortment of verticals and business cases. Joining it with Power BI can make amazing logical abilities. We can utilize Linear Regression to break down the impact of promoting deals and benefits. On the other hand, it can clue an organization into how raising costs may influence a customer's purchasing propensities. Insurance agencies can likewise utilize this method to evaluate connections between client socioeconomics and protection claims.


Similar Articles