Introduction
Data is only as powerful as the shape it’s in. Before dashboards tell compelling stories and visuals drive decisions, data must first be cleaned, structured, and trusted. In Power BI, this transformation happens in Power Query, the engine that converts raw, messy data into meaningful insights.
If you’re new to Power BI, one of the most important skills you can learn is data preparation. No matter how impressive your visuals look, poor-quality data will always produce poor insights. That’s why cleaning and transforming data is a critical step in every Power BI project.
Power Query enables you to clean, reshape, and prepare data before loading it into the data model. With it, you can:
- Fix inconsistencies and errors
- Handle missing or null values
- Remove duplicate records
- Reshape tables
- Merge or append datasets
- Apply user-friendly naming conventions
- Create a clean and reliable data model for reporting
In this beginner-friendly guide, you’ll learn step-by-step how to clean, transform, and load data in Power BI using a practical hands-on dataset.
What You Will Learn
By the end of this guide, you will be able to:
- Resolve inconsistencies and data quality issues
- Remove duplicate records
- Remove or replace null values
- Apply meaningful value replacements
- Profile data to assess column quality
- Evaluate and transform column data types
- Reshape tables using Pivot and Unpivot operations
- Combine and merge queries
- Apply clear and user-friendly naming conventions
- Edit transformations using the Advanced Editor (M Code)
*Opening Power Query Editor
*
In Power BI Desktop:
Go to the Home tab
Select Transform Data
This opens the Power Query Editor, where all data cleaning and transformation tasks are performed.
Load a clean and reliable data model into Power BI
Identify Column headers and names
The first step in shaping your data is to identify the column headers and names, then verify their locations to ensure they are in the right place.
In the following screenshot, the source data in the CSV file for Product_Sales had a target categorized by productKey, product sub-category key, unit cost, and unit price, which are organized into columns, but are not in the right place.

Once you have identified where the column headers and names are located, you can reorganize the data.
The image illustrates how the Use First Row as Headers feature impacts the data
To correct this inaccuracy, you need to remove some of the top rows as they contain data we do not need in this report, and promote the first table row into column headers.
You can promote headers in two ways: by selecting the Use First Row as Headers option on the Home tab or by selecting the drop-down button next to Column1 and then selecting Use First Row as Headers.

Rename Column
The next step in shaping your data is to examine the column headers. You might discover that one or more columns have the wrong headers, a header has a spelling error, or the header naming convention is not consistent or user-friendly.
You can rename column headers in two ways. One approach is to right-click the header, select Rename, edit the name, and then press Enter. Alternatively, you can double-click the column header and overwrite the name with the correct name.
Removing Duplicates in Power Query
To remove duplicate records:
- Select the column(s) that should contain unique values
- Right-click the selected column
- Choose Remove Duplicates
Power Query keeps the first occurrence and removes the rest.
Removing or Replacing Null Values
To remove null values:
- Open the column filter dropdown
- Uncheck null
You can also replace null values:
- Right-click the column
- Select Replace Values
- Enter an appropriate replacement value

Note:
Power Query treats null as a distinct value type. In some scenarios, you may also use Replace Errors or transformation options to handle missing data effectively.
*Profiling Data to Understand Column Quality
*
From the View tab, enable:
- Column Quality
- Column Distribution
- Column Profile
These profiling tools help you identify:
- Empty values
- Errors
- Duplicate values
- Value distribution issues before analysis begins.
Reshaping Data with Pivot and Unpivot
Reshaping data is an essential transformation skill in Power Query.
- Unpivot converts columns into rows
- Pivot converts rows into columns This is especially useful when working with monthly or repeated values.
Merging and Appending Queries
Merging Queries (JOIN) Combines tables based on a common column (like SQL JOIN).
- Home → Merge Queries
- Choose join type:
- Inner
- Left Outer
- Right Outer
Appending Queries (UNION)
Stack tables vertically.
Home → Append Queries
Example:
Combine:
- 2019 sales
- 2020 sales
Conclusion
Cleaning and transforming data is the foundation of effective Power BI analysis. Power Query provides powerful tools to remove duplicates, handle missing values, profile data quality, reshape tables, and build reliable data models for reporting.
Mastering these skills will help you create dashboards that are not only visually appealing but also accurate, efficient, and professional.












Top comments (0)