π 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 * UnitPriceif 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
Viewtab 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!