Microsoft Power BI Guide — Part 3(Preparing the Environment and Getting Started)

Sandaruwan Herath
Data Science and Machine Learning
6 min readJun 7, 2024

Before diving into our Power BI project, it’s essential to set up the environment correctly to ensure consistency and avoid potential issues. This article will guide you through the steps to create your initial project file and configure the necessary settings. Additionally, we’ll introduce you to the basics of data transformation in Power BI.

Creating the Initial Project File

Option window

1. Open Power BI Desktop:

· Double-click on the Power BI Desktop shortcut to launch the application.

· Close the untitled file that opens by default.

2. Set Up Global and Current File Settings:

· Go to File > Options and settings > Options.

3. In the GLOBAL section, navigate to Regional Settings:

· Set the Application language and Model language to English (United States).

4. In the CURRENT FILE section, make the following changes:

· Data Load: De-select all options under Data Type detection and Relationships to manually control these aspects.

· Regional Settings: Set the locale to English (United States) for consistent interpretation of numbers, dates, and times.

5. Save the Project File:

· Click on the Save button.

· Navigate to a folder of your choice, and name the file (e.g., FirstProjectFile.pbix).

· Close and restart Power BI Desktop.

· Open the saved project file to ensure all settings are applied.

Handling Downloaded Project Files

Sometimes, you may work with the project files provided. Here’s how to handle them:

1. Download and Unzip the Project Files:

· Download the attached zip file from the resource section.

· Right-click on the zip file and select Extract All.

2. Adjust Data Source Settings:

· Open the unzipped project file in Power BI Desktop.

· Go to Home > Transform data > Data source settings.

· Locate the data sources listed and click Change Source to update the file path to match your local machine.

· You can either manually paste the correct file path or use the Browse option to navigate to the folder and select the file.

· Click OK and then Close to apply changes.

Getting Started with Data Transformation

Once the environment is set up, the next step is to transform your data. Power BI offers powerful tools for data transformation, primarily through the Power Query Editor.

1. Connect to Data Sources:

· Click on Get data and choose the type of data source (e.g., Excel).

· Navigate to the location of your data file and open it.

2. Use the Power Query Editor:

· After loading the data, click on Transform Data to open the Power Query Editor.

· Here, you can perform various transformations, such as:

· Renaming Columns and Tables: Double-click on the column headers and table names to make them more readable.

· Removing Null Values: Identify and remove rows with unnecessary null values.

· Promoting Headers: Use the Use First Row as Headers option to set the first row as column headers.

· Unpivoting Columns: Transform columns into rows to create a more usable format.

3. Apply and Close:

· After making the necessary transformations, click on Close & Apply to load the cleaned data into your model.

4. Creating Visualizations

· With the data transformed and loaded, you can now create visualizations to analyze your data.

5. Select Visualization Type:

· In the Report View, choose the type of visualization you want to create (e.g., Stacked Column Chart, Line Chart).

· Drag the relevant fields (e.g., GDP, Years, Countries) into the visualization pane.

6. Format and Customize:

· Use the paint roller icon to adjust the formatting and style of your visualizations.

· Add slicers and filters to create interactive elements for your reports.

7. Building a Data Model:

· Go to the Model View and establish relationships between tables by dragging and dropping relevant columns.

· Verify and adjust relationships to ensure accurate data analysis.

Sample Case Study — Analyzing Financial Data with Power BI

In this mini-project, we’ll simulate a real-world scenario where a company needs to analyze its financial data to gain insights into sales performance across different segments, countries, and products. We’ll use the provided dataset to create a Power BI report that includes data transformation, modelling, and visualization.

Dataset Overview

The dataset contains financial data with the following columns:

Segment, Country, Product, Discount Band, Units Sold, Manufacturing Price, Sale Price, Gross Sales, Discounts, Sales, COGS (Cost of Goods Sold), Profit, Date, Month Number, Month Name, Year

Step 1: Prepare the Environment

Name the file (e.g., FinancialAnalysis.pbix).

Step 2: Data Transformation

Transform the Data:

· Rename Columns: Ensure all column names are meaningful and correctly spelled.

· Handle Null Values: Remove or fill null values if necessary.

· Promote Headers: Make sure the first row is set as headers if not already.

· Data Types: Ensure that all columns have the correct data types (e.g., Date, Numbers).

Example Transformations:

· Rename the Manufacturing Price column to Mfg Price.

· Ensure the Date is in Date format, Units Sold, Sale Price, etc., are in Decimal format.

Close & Apply:

· Click on Close & Apply to load the transformed data into the Power BI model.

Step 3: Data Modeling

Create Relationships:

If there are multiple tables, establish relationships by dragging and dropping related columns.

For this project, since we have a single table, no additional relationships are needed.

Step 4: Data Visualization

Create a Report:

In the Report View, create various visualizations to analyze the data.

Visualizations:

1. Sales Performance by Segment:

Create a bar chart to show the total sales for each segment.

2. Country-wise Sales Analysis:

Create a map visualization to display sales distribution across different countries.

3. Monthly Sales Trend:

Create a line chart to show sales trends over the months.

4. Profit Margin Analysis:

Create a pie chart to show profit distribution across different products.

5. Add Filters and Slicers:

Add slicers for Year, Country, and Segment to create interactive filters.

6. Formatting and Customization:

Use the formatting options to adjust the visuals for better readability and presentation.

Summary

By following these steps, you will create a comprehensive Power BI report that provides insights into the company’s financial performance. This mini-project demonstrates how to transform, model, and visualize data in Power BI, preparing you for more complex analyses and real-world projects.

Feel free to explore additional features and customization options in Power BI to enhance your report further.

--

--

Sandaruwan Herath
Data Science and Machine Learning

IT Consultant/Lecturer | Data Analyst/BI Consultant/Machine Learning