Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

aysegulyigit

Regression Analysis in Power BI

This study aimed to investigate whether salaries increase with experience by conducting a simple regression analysis. The analysis was performed using Power BI's Python visualization tool. Below is a step-by-step explanation of the process.

1. Data Source and Preparation

The dataset used for this analysis was sourced from an Excel file, comprising two primary columns: "Experience" and "Salary." These variables were utilized to explore the relationship between employees' experience and their respective salaries.

To load the data into Power BI, the following steps were taken:

  • Navigated to the Home tab and selected Get Data.
  • Choose Excel as the data source and imported the relevant file.
  • Transformed the data into a table and selected the necessary columns.

2. Analysis with Python Visualization Tool

For data visualization, I employed Power BI’s Python script visualization tool. This tool provides flexible and powerful visualizations by enabling direct work with Python within Power BI.

  • In the Report section, I added a Python Visual.
  • The following Python script was then entered into the tool:

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

 

# dataset = pandas.DataFrame(tecrube, maas)

# dataset = dataset.drop_duplicates()

 

# Paste or type your script code here:

import matplotlib.pyplot as plt

import seaborn as sns

sns.set(rc={'figure.figsize':(10,7)})

sns.regplot(data=dataset, x="Experience", y="Salary")

plt.show()

 

 

 

3. Regression Analysis and Results

The above code generated a visual regression analysis, assessing the relationship between Experience and Salary. Using Python's seaborn library, a regression line was plotted over the dataset to illustrate how salary changes with increasing experience.

  • Regression Line: The linear trendline on the graph visually represents whether salaries increase as experience grows. A positively sloped line would indicate a direct correlation, meaning that as experience increases, so does salary.

aysegulyigit_0-1727628312875.png

The regression analysis revealed a positive correlation between experience and salary. The visualization indicated that more experienced employees tend to earn higher salaries. This type of analysis can be particularly useful for optimizing hiring and salary policies in an organization.