Power BI Metrics Book

Agent First BI for Power BI.

Your agents ask. Your Power BI answers, with one definition per metric.

POWER BISalesNet salesFinanceRevenueMarketingNet SalesPOWER BI METRICS BOOKnet_sales3 measures, 11 variantsCSVnet_sales_by_month_2025.csvAGENTS AND INTERNAL TOOLSsales-dashboardClaude CodeNet sales by month?searchget_metricexecute_daxClaude CodeCodexCursorPower BI Metrics Bookmetricnet_sales, from 3 measuresresulta CSV file, every rowPower BIdatasetsSales, Finance, Marketingaccessread, never changed
POWER BISalesNet salesFinanceRevenueMarketingNet SalesPOWER BI METRICS BOOKnet_sales3 measures, 11 variantsCSVnet_sales_by_month_2025.csvAGENTS AND INTERNAL TOOLSsales-dashboardClaude CodeNet sales by month?searchget_metricexecute_daxClaude CodeCodexCursor
Agents and internal toolsan example run in Claude Code

How much did we sell last year, by month? I need it as a file.

  1. search"net sales"net_sales
  2. get_metricnet_salesSUM(Sales[Net amount])
  3. execute_daxon Sales12 rows as you, csv_url
  4. curl -ocsv_urlnet_sales_by_month_2025.csv
Agents and internal tools
agents ask in plain words, as you. tools the same DAX, with an API key.
Power BI Metrics Book
metric net_sales, from 3 measures. result a CSV file, every row.
Power BI
datasets Sales, Finance, Marketing. access read, never changed.

Power BI has the numbers you trust. Your agents can't use them yet.

  • Power BI reports hold the right numbers, for people to read.
  • An agent on raw DAX can ask anything, and guesses what each measure means.
  • Microsoft's own connectors are built for Fabric and the Microsoft stack.

Power BI Metrics Book gives any agent the definitions your reports use.

Power BI reports have the same numbers as your reports but are closed to agents. An agent on raw DAX is open to any agent but guesses. Power BI Metrics Book is both. Open to any agentSame numbers as your reportsPower BI reportsRight numbers, for peopleAgent on raw DAXAsks anything, guessesPower BI Metrics BookAny agent, your definitions

Three things break when an agent writes its own DAX

  1. It picks the wrong measure

    Net sales, Revenue and Net Sales are one calculation in three datasets. The agent can't tell.

    Here: the sync finds they are one metric, net_sales, and names its variants.

  2. It fills its context

    A year of daily sales lands in the chat, and the agent loses the thread.

    Here: the agent downloads the full result as a CSV file into its folder. Only a preview of up to 100 rows goes into the context.

  3. It runs as someone else

    A shared account answers with its own rights, not the rights of the person asking.

    Here: every query runs with the asking person's own Power BI sign-in, so row-level security holds.

From an empty VM to your first agent query in under 30 minutes

Three commands start the stack. Then a setup in your browser checks each step before the next.

the VM
$ uv tool install powerbi-metrics-book

pbmb writes the deployment and runs the admin commands.

Not released yet. These commands work from 0.1, the first release. Until then, run it on the sample tenant.

The quickstart, step by step

Add one address to your agent

The MCP connector is the main way in. Each agent signs in as you, through your browser, so it reads only what your Power BI already lets you read.

  1. Add the address

    Your deployment's address with /api/mcp on the end. One command in Claude Code or Codex, one file in Cursor.

  2. Sign in through your browser

    Press Allow on the consent screen. It names you, the client and where it sends you back.

  3. Ask

    The agent searches the book, reads the metric's definition and runs its DAX as you. A big result stays on the server until the agent asks for it.

claude mcp add --transport http powerbi_metrics_book \
  https://metrics.example.com/api/mcp

# then run /mcp, choose powerbi_metrics_book and sign in

The command line

For scripts, and for agents without MCP:pbmb login --url https://metrics.example.com

The REST API

For a job that runs without a person, with a service-account key and the same rules as everyone else.

Connect an agent, step by step

Build internal tools on the same numbers

Your agent finds the data with you over MCP. Then your tool runs the same DAX with an API key. You never write Power BI sign-in code.

# once, as an admin
$ pbmb sa create sales-dashboard \
    --owner data-team@example.com \
    --role viewer --workspace <workspace id>
$ pbmb sa keys create sales-dashboard \
    --expires-in-days 30

# then from your tool, with the DAX your agent wrote
$ curl -X POST "$PBMB_URL/api/v1/queries" \
    -H "Authorization: Bearer $PBMB_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"dataset": "Sales", "dax": "EVALUATE ..."}'
Sales dashboardservice account sales-dashboard
Net sales, 2025175,802
Best monthMay, 17,532
Rows12
POST /api/v1/queries answered 201 with 12 rows. Numbers from the sample tenant's Sales dataset.
Your agentYour tool
Connects toThe MCP connectorThe REST API, /api/v1
Signs in withYour own sign-in, in your browserAn API key of a service account
SeesWhat Power BI lets you seeThe workspaces an admin gave it
Good forFinding the metric and writing the DAXRunning that DAX in a screen or on a schedule

A service account queries only after an admin turns onpowerbi.service_account_queries. It runs as the app's own service principal, so it never queries a dataset with row-level security.

Build on the API, step by step

Everything runs on one VM

You run it yourself, with Docker Compose on one VM of at least 2 vCPUs, 4 GB of memory and 40 GB of disk. The deploy guides say where to get one. One deployment serves one organisation and one Power BI tenant.

OpenAI or Geminiembeddings, optionalOne VM, one Docker Compose appSalesFinanceMarketingyour Power BIyour agentNet sales bymonth, 2025?Cerbospolicy checksworkersync, no portproxyCaddy, TLSapiMCP, REST, webPostgresbook, resultsOne VM, one Docker Compose appCerbospolicy checksworkersync, no portproxyCaddy, TLSapiMCP, REST, webPostgresbook, results

See the stack, container by container

Where to run it

Each guide ends with pbmb admin status passing against the new address, and says who acts at each step.

GuideWhat runs whereFollowed
One VM with Docker ComposeThe reference deployment, and the cheapest. Caddy in front for TLS, and nightly backups off the VM.The guide has been followed.
Dokploy or Coolify on a VMThe same compose file, with the domain and certificate from Dokploy.Not yet followed on a real account.
RailwayA service per container, with no server to look after.Not yet followed on a real account.
Azure Container AppsFor a company that already runs Power BI in Azure.Not yet followed on a real account.
KubernetesNo chart yet. The page lists what the containers already meet.No guide yet.

Open source, under Apache 2.0

The code, the docs and the issues are on GitHub. Nothing is held back for a paid edition, because there is none.

  • Report a bug or ask for a feature

    Open an issue on GitHub. The templates ask for what a fix needs.

  • Report a security issue

    Privately, never in a public issue. The page says how, and what happens next.

  • Contribute

    How to set up, run the whole stack on the sample tenant, check a change and open a pull request.

  • Metrics Book

    The sister project, for a company that is not tied to Power BI. The two share one look and one set of words.

Need help with implementation or strategy?

Enum Studio builds and maintains Power BI Metrics Book, and helps companies set it up and build on it.

Get help from Enum Studio