Concepts

Core ideas and patterns in the Power Query M language. Understanding these concepts will help you write faster, more maintainable queries.

Common M Errors

The most frequent error messages beginners encounter in M, what causes them, and how to fix them.

Control Structures (if/then/else)

M's sole branching construct — if/then/else — and how to write clean conditional logic.

Custom Functions

How to create reusable custom functions in M to modularize your code, reduce duplication, and build shareable function libraries.

Date, Time, and Duration Types

The five temporal types in M — date, time, datetime, datetimezone, and duration — how they differ, how to convert between them, and common pitfalls.

The each Keyword

Understanding each as shorthand for single-parameter functions, and how bracket notation accesses row fields.

Error Handling

How to handle errors gracefully in M using try, otherwise, and error records.

Getting Started with M Code

What M code is, where to find it, and how to start reading and writing it — for Power BI users who have only ever used the UI.

Identifiers & Scoping

The three kinds of identifiers in M, how variable scope works, and how closures capture values from outer scopes.

Internal Functions

What internal-only Power Query M functions are, why Microsoft includes them in the spec, and why PQM.guide documents them.

Lazy Evaluation & Table.Buffer

How M evaluates expressions on demand, and when you need Table.Buffer to force eager evaluation.

let...in Expressions

How let...in organizes M code into named steps, and why step order does not dictate evaluation order.

Literal Constructors

M's #-prefixed literal constructors create typed values inline — #date, #datetime, #datetimezone, #time, #duration, #binary, and #table — without calling conversion functions.

The M Paradigm

Why M is a functional language, what immutability means in practice, and how this shapes the way you write queries.

Metadata

How to attach, read, and use metadata on M values — the mechanism behind function documentation, type facets, and custom annotations.

MissingField Handling

How to make your queries resilient to upstream column changes using MissingField options.

Null Handling

How null values propagate through expressions, and practical patterns for dealing with missing data in M.

Where Power Query Runs

A complete map of every environment where Power Query M can be executed — from desktop tools to cloud dataflows to the new Fabric programmatic API.

Query Folding

How Power Query translates M steps into native data source queries for dramatically better performance.

Sections & the Shared Environment

The hidden organizational structure of M programs — sections, section members, and the #shared global environment.

Structured Data: Records, Lists & Tables

How M's three structured types — records, lists, and tables — relate to each other and how data flows between them.

Type System

How M's type system works — primitive types, nullable types, type annotations, and their impact on performance.

From the UI to M Code

The ten most common Power Query UI operations and the M code each one generates — a translation guide for users making the switch from clicks to code.