๐ Power Query โ Data Transformation in Power BI (with Example)
๐
Updated: June 2025
โ๏ธ By TechTown.in
๐ Keywords: Power Query, Data Transformation, Power BI, Load vs Transform, CSV to Table, ETL in Power BI, Power BI CSV Import
Sample file :
๐ฐ What is Power Query?
Power Query is Power BIโs built-in data transformation engine. It allows you to take raw data from different sources โ like Excel, CSV, or databases โ and clean, shape, and prepare it for powerful visual analysis.
You donโt need to be a coder or data scientist. With point-and-click tools, Power Query lets you:
- Remove errors
- Fix column types
- Split/merge columns
- Create calculated fields
- Apply conditional logic
- And much more!
Itโs where ETL (Extract, Transform, Load) happens in Power BI.
๐ฅ Starting with Data Import โ The Example CSV
Letโs say we import a file called:
๐ techtown_sales_data_jan2025.csv
When loaded into Power BI Desktop, you first land in the Navigator screen (as shown in your image). This gives you a snapshot of the data and a choice:

๐ข Load
- Loads the data as-is directly into Power BI.
- No transformation โ just straight into the data model.
- Useful if the dataset is already clean.
๐ ๏ธ Transform Data
- Opens the Power Query Editor.
- Allows you to edit, clean, and reshape the data.
- Best for real-world messy datasets.
โ Pro Tip: Always click on Transform Data if you’re unsure about data quality.
๐ง Understanding the Dataset
Hereโs a quick look at the columns weโre working with:
Column | Description |
---|---|
Date | Order date |
OrderID | Unique order identifier |
CustomerID | Customer code |
CustomerName | Customer full name |
ProductCategory | Type of product |
ProductName | Specific product name |
Quantity | Units purchased |
UnitPrice | Price per unit (โน) |
TotalSale | Quantity ร UnitPrice |
StoreRegion | Regional store location |
๐ What is Data Transformation?
Data transformation means converting raw data into clean, structured, and meaningful data.
Using Power Query, here are some transformations you might perform:
โ Common Transformations:
Task | Power Query Feature |
---|---|
Remove unwanted columns | Home โ Remove Columns |
Fix data types (e.g. date/text) | Transform โ Data Type |
Fill missing values | Transform โ Fill โ Down/Up |
Remove duplicates | Home โ Remove Rows โ Remove Duplicates |
Add new calculations | Add Column โ Custom Column |
Split full names | Split Column โ By Delimiter |
Rename columns | Right-click โ Rename |
Combine columns | Transform โ Merge Columns |
Filter records | Filter icon on column headers |
๐ ๏ธ Real-Life Example: Steps in Power Query
When we hit “Transform Data”, Power Query Editor opens. Hereโs a sample transformation flow for this dataset:
- Promote Headers
โค Automatically uses first row as column headersStep: Promoted Headers
- Change Data Types
โค Make sure Date isDate
, Quantity isWhole Number
, UnitPrice isDecimal
, etc.Step: Changed Type
- Add a Custom Column
โค RecalculateTotalSale = Quantity * UnitPrice
if not already presentAdd Column โ Custom Column โ [Quantity] * [UnitPrice]
- Remove Unwanted Columns
โค Say you donโt needCustomerID
, you can remove itHome โ Remove Columns
- Split Full Name (Optional)
โคCustomerName โ Split Column โ By Space โ First Name, Last Name
๐ Output: Cleaned & Ready Data
After transformation, your dataset is:
- Structured
- Properly typed
- Filtered
- Enriched with calculated fields
Then, click on Close & Apply
to load this data into Power BIโs Data Model โ ready for reports, visuals, and dashboards.
โ๏ธ Load vs Transform โ What Should You Choose?
Option | When to Use |
---|---|
Load | If the data is already clean and formatted |
Transform | If the data is messy, needs calculations, filters, cleanup |
โ Best Practice: Always review in Power Query Editor โ even a clean CSV can have wrong data types or NULLs.
๐ Related Features in Power Query
Feature | Use Case |
---|---|
Column Quality | Visual indicators of errors, nulls, valid values |
Column Distribution | Frequency charts of column values |
Merge Queries | Join data from two different sources |
Append Queries | Stack data from multiple files/tables |
Group By | Create summarized tables (e.g., total sale by region) |
Parameters | Reusable dynamic values (like Date filters) |
๐ง Power Tips for Beginners
- Enable Column Profiling via the
View
tab to see column statistics - Use Remove Errors to clean broken rows
- Always check data types before loading
- Use Advanced Editor to view underlying M code for each step
- Every transformation is recorded and repeatable โ ideal for automated reports
๐ Conclusion
Power Query isnโt just a tool โ itโs your first line of defense in building clean, trusted data models in Power BI.
With its no-code interface and powerful transformation capabilities, Power Query empowers analysts, students, and professionals to prepare data like a pro.
๐ If you clean data well, your insights become powerful.
Begin every Power BI project in Power Query Editor โ and youโre already 50% done!