list_power_query
Extract the Power Query (M) code behind a Power BI model, including loaded table queries, shared queries/functions, and optional named step breakdowns; filter by table when needed.
Instructions
Get the Power Query (M) code behind the model: each loaded table's
query steps (the let/in M code, including its transformation step
names), plus shared queries/functions/staging steps that feed other
queries but don't load into a visible table themselves (Enable Load =
Off). Pass table to filter table_queries to one table; shared queries
aren't table-scoped so they're always returned in full.
With include_steps (default True), each query also comes broken into
its named steps in source order, each with the sub-step names it
references -- e.g. step "Changed Type" references step "Source". This
is a structural breakdown of the M source text, not a live
evaluation: there's no local API into the mashup engine that actually
executes these steps, only into the already-loaded tabular model, so
this can't show you the data at each step the way Power Query Editor's
step preview does -- it can only show you the steps and how they chain
together, which is usually enough to spot which step to look at. Each
table_queries entry also includes the partition's live refresh state
and error_message; use diagnose_power_query for just that, across all
tables, without the M text.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | No | ||
| instance | Yes | ||
| include_steps | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||