Power Query: The Complete Guide to Data Transformation in 2026
Power Query: The Complete Guide to Data Transformation in 2026
Master Power Query for Power BI and Excel — data connections, transformations, M language, query folding, and enterprise ETL patterns.
Power Query is the data transformation engine built into Power BI Desktop, Excel, and Microsoft Fabric Dataflows. It provides a visual, no-code interface for connecting to data sources, cleaning messy data, reshaping tables, and loading the results into your data model. With 12,100 monthly searches, Power Query is one of the most sought-after skills in the data analytics world.
What Is Power Query?
Power Query is an ETL (Extract, Transform, Load) tool that lets you: - Connect to 500+ data sources (databases, files, APIs, cloud services) - Transform data with a visual step-by-step editor - Combine data from multiple sources with merges and appends - Load clean, structured data into Power BI models or Excel tables
Under the hood, Power Query uses the M language (Power Query Formula Language) — a functional language that generates automatically as you apply transformations. You can edit M directly for advanced scenarios.
Where Is Power Query Available?
| Product | Power Query Version | Use Case |
|---|---|---|
| Power BI Desktop | Full editor | Build data models for reports |
| Excel | Full editor | Self-service data prep |
| Fabric Dataflows Gen2 | Cloud version | Centralized ETL pipelines |
| Azure Data Factory | Wrangling flows | Enterprise data engineering |
| Power Apps | Basic version | App data transformation |
Essential Power Query Transformations
Column Operations - Remove Columns — Delete unnecessary fields to reduce model size - Rename Columns — Use business-friendly names - Change Type — Set correct data types (critical for DAX performance) - Split Column — Break "City, State" into separate columns - Merge Columns — Combine first + last name - Unpivot Columns — Transform wide tables into tall format (essential for time series) - Pivot Columns — Transform tall tables into wide format
Row Operations - Filter Rows — Remove nulls, errors, or unwanted values - Remove Duplicates — Deduplicate by key columns - Keep/Remove Top/Bottom N — Limit rows - Sort — Order by any column
Adding Calculations - Custom Column — Add columns with M formulas - Conditional Column — If/then/else logic - Index Column — Auto-incrementing row numbers - Column from Examples — AI-powered: show examples, PQ generates the formula
Combining Data - Merge Queries — Join two tables (inner, left outer, right outer, full outer, anti) - Append Queries — Stack tables vertically (union) - Folder Connector — Combine all files in a folder automatically
Query Folding: The Performance Secret
Query folding is when Power Query translates your transformation steps back into the source's native query language (SQL, OData, etc.) and lets the source do the heavy lifting. This dramatically improves performance.
Steps That Fold - Filter rows → WHERE clause - Select columns → SELECT clause - Sort → ORDER BY - Group by → GROUP BY - Merge → JOIN - Remove duplicates → DISTINCT
Steps That Break Folding - Custom M functions - Adding index columns - Pivot/unpivot operations - Most text transformations
Best Practice: Keep foldable steps at the top of your query, non-foldable at the bottom. Right-click any step → "View Native Query" to verify folding is working.
For a deep dive, see our query folding troubleshooting guide.
The M Language
M is the functional programming language behind Power Query. Every visual transformation generates M code:
Common M Patterns
Filtering rows: Table.SelectRows(Source, each [Sales] > 1000)
Adding a custom column: Table.AddColumn(Source, "Profit Margin", each [Revenue] - [Cost])
Merging tables: Table.NestedJoin(Orders, {"CustomerID"}, Customers, {"ID"}, "CustomerData", JoinKind.LeftOuter)
Handling errors: try [Column] otherwise null
You don't need to learn M to use Power Query effectively — the visual editor covers 90% of use cases. But M opens up advanced patterns like dynamic data sources, parameterized queries, and custom functions.
Enterprise Power Query Patterns
Parameterized Queries Create parameters for database server names, date ranges, or environment flags. Switch between dev/test/prod without changing queries.
Custom Functions Write reusable M functions that can be applied to multiple tables. Essential for processing files in a folder or applying consistent transformations.
Error Handling Use try/otherwise patterns to handle nulls, type mismatches, and connection failures gracefully. Critical for production-grade data pipelines.
Incremental Loading Load only new or changed data instead of full refreshes. Dramatically reduces refresh times for large datasets. See our incremental refresh guide.
Power Query vs. Alternatives
| Feature | Power Query | Python/Pandas | SQL | dbt |
|---|---|---|---|---|
| Learning Curve | Low (visual) | High (code) | Medium | Medium |
| Performance | Good (with folding) | Variable | Excellent | Excellent |
| Self-Service | Excellent | Poor | Poor | Poor |
| Enterprise Scale | Good (Dataflows) | Good | Excellent | Excellent |
| Integration | Native to PBI/Excel | External | External | External |
Getting Help
Power Query is the foundation of every Power BI project. Mastering it will save you hours of manual data preparation and ensure your models are clean, performant, and maintainable.
Need help with complex Power Query transformations? Our data analytics team specializes in enterprise ETL design and optimization. Contact us for a consultation.
Frequently Asked Questions
What is Power Query and how is it different from DAX?
Power Query handles data extraction and transformation — getting data from sources, cleaning it, and loading it into your model. DAX (Data Analysis Expressions) handles calculations and analysis on the loaded data. Think of Power Query as the "getting data ready" step and DAX as the "analyzing data" step. They work together: Power Query builds the model, DAX queries it. You should do as much work as possible in Power Query before using DAX.
Do I need to learn the M language to use Power Query?
No, the visual editor covers approximately 90% of common use cases. You can filter, merge, pivot, and transform data entirely through point-and-click operations. However, learning basic M syntax unlocks advanced patterns like parameterized queries, custom functions, and dynamic data sources. We recommend starting with the visual editor and gradually learning M as you encounter more complex scenarios.
What is query folding and why does it matter?
Query folding is when Power Query translates your transformation steps into the source database's native query language (usually SQL) and lets the database do the processing. This is critical for performance because the database can handle millions of rows much faster than Power Query's in-memory engine. If folding breaks, Power Query downloads all the raw data and processes it locally, which can be extremely slow for large datasets.
Can Power Query connect to REST APIs?
Yes, Power Query has a Web connector that supports REST APIs. You can send GET and POST requests, pass headers and authentication tokens, parse JSON/XML responses, and handle pagination. For complex APIs, you may need to write custom M functions. Power Query also supports OData feeds natively with automatic pagination and filtering.