Data Preparation in Power BI

Data Preparation in Power BI

Data preparation is a very critical step in the process of data analysis, ensuring that raw and complex data is converted into a clean and well-structured format that helps make an informative dashboard. In Power BI, data preparation increases reporting performance. Power BI offers powerful tools such as Power Query Editor, Data Profiling, and Column Quality indicators. In this blog, you will understand data preparation, types, steps to prepare data, and its best practices in detail.

Table of Contents:

What is Data Preparation in Power BI?

Data preparation is the process of collecting, cleaning, transforming, and organizing raw data into a usable format, which helps users to study the data better and helps in decision-making by extracting hidden information from it. In Power BI, it is a very useful process, and it uses the Power Query Editor to transform your data into a clean format.

Types of Data Preparation in Power BI

There are four types of data preparation in Power BI:

  • Data Cleaning: Data cleaning is the process of removing errors and duplicates in your data.
  • Data Transformation: Data Transformation is used to convert data to a suitable format.
  • Data Integration: Data integration is used to combine data from different sources into a single view.
  • Data Reduction: Data Reduction is used to reduce the size or complexity of data by removing unnecessary details, which improves performance.

Advantages of Data Preparation in Power BI

  • Improved Data Quality: Preparing your data involves cleaning it, removing duplicates, and resolving errors.
  • Faster Analysis: Clean and structured data are more easily examined, which helps in better and faster analysis of data.
  • Better Performance: Cleaned data improves the performance of data models and reduces the time to load data.
  • Improve Decision-Making: Cleaned and structured data helps users to make correct decisions based on trends in data.
  • Better Visualization: Cleaned and structured data are easy to understand and give better visualization.

Steps to Prepare Data in Power BI

Let’s explore the steps required to prepare your data in Power BI.

Step 1: Import Data: Click on Home>Get Data>Text/CSV

DateProductQuantityPriceRegion
2023-01-01iPhone2800East
2023-01-02Samsung TV11200South
2023-01-03HP Laptop11000East
2023-01-04null3300West
2023-01-05Office ChairNull150North
2023-01-06iPhone1nullSouth

Step 2: Transform the data: Click on Transform Data in the Home Ribbon.

Transform the data

Step 3: Remove null or Blank Values

Null refers to missing data, while blank can represent empty cells in Power BI

  • Select the Product column
  • Go to Home>Remove Rows>Remove Blank Rows.
  • Repeat the same steps for removing null values in the Quantity and Price columns.
Remove null or Blank Values

Step 4: Add a New Column 

Add a new column which will calculate total sales (Total Sales Quantity * Price)

Click on Model View and click on Create column, and write the given DAX formula.

Total Sales=[Quantity] * [Price]
Add a New Column 

After clicking on ‘Create Column‘, a formula bar will appear

Create Column

Step 5: Extract Year and Month from Date

  • Select the Date column.
  • Go to Add Column>Date>year>year> Create a year column.
  • Add Column>Date>Month>Name of the Month>Creates a Month Column.
Extract Year and Month from Date

Step 6: Check Data Types: Check Data Types for each column

  • The Date column should be of the Date type.
  • Product, Region, and Month should be in Text type.
  • Quantity, Price, and Total Sales should be in Whole numbers or Decimal numbers.

Step 7: Result: After carrying out all the operations, this is how your dataset will look.

Result

Explanation: Here, in this table:

  • All Null values are removed.
  • Year and Month are extracted from the Date Column.
  • All columns have the correct Data type.

Performance Optimization during Preparation

  • Filter unwanted rows and eliminate unused columns to reduce model size.
  • Use correct data types in Power Query to get an accurate result.
  • Use measures over calculated columns as they are calculated, not stored.
  • Transform your data before loading it into a model.

Best Practices

  • After bringing data to Power BI and modifying it according to your needs with Power Query help, check to see that it does not contain any blank values.
  • While you are executing all the data preparation steps, see if you can have these steps recorded so that you can check which ones were applied.
  • Review to see if you have some columns that are not necessary and delete them; this will have a positive impact on performance.
  • Make sure you are using the proper name for the respective column, so that it adds to the understanding of the data.

Conclusion

Data preparation is one of the most important steps of data analysis, and doing it correctly makes your data well-structured. Removing nulls and creating an extra calculated column helps you transform your raw data into powerful data. Preparing your data saves time and improves performance, which helps you to make better decisions. Power BI is a strong tool that helps you get your data ready. Simple actions like cleaning data and adding columns make your data better, faster, and easier to use.

To learn more about Power BI and its functions, check out this Power BI Course and also explore Power BI Interview Questions prepared by industry experts.

Data Preparation in Power BI – FAQs

Q1. What is data preparation in Power BI?

Data preparation is the process of preparing and cleaning data for data analysis.

Q2. How do I remove null values in Power BI?

You can remove null values by applying a filter or by clicking Remove Blank Values in Power Query Editor.

Q3. How do I extract the Year or Month from a date?

Select the Date column → Go to Add Column > Date → Choose Year or Month.

Q4. What is Power Query?

Power Query is the built-in tool in Power BI used for transforming your data.

Q5. Can I calculate new columns in Power BI?

Yes, the new columns can be calculated using Custom Column in Power Query or DAX in the Data View.

Data Analytics for Business