Skip to main content

CLI for Power BI semantic models and PBIR reports - direct .NET connection for token-efficient AI agent usage

Project description

pbi-cli

Give Claude Code the Power BI skills it needs. Install once, then just ask Claude to work with your semantic models and reports.

Python CI License

Get StartedSkillsAll CommandsREPL ModeContributing


What is this?

pbi-cli gives Claude Code (and other AI agents) the ability to manage Power BI semantic models and reports. It ships with 12 skills that Claude discovers automatically. You ask in plain English, Claude uses the right pbi commands.

You                        Claude Code              pbi-cli              Power BI
 "Add a YTD measure   --->  Uses Power BI    --->   CLI commands   --->  Desktop
  to the Sales table"       skills (12)

Two layers, one CLI:

  • Semantic Model -- Direct .NET interop to Power BI Desktop (measures, tables, DAX, security)
  • Report Layer -- Reads/writes PBIR JSON files directly (visuals, pages, themes, filters)

Get Started

Fastest way: Just give Claude the repo URL and let it handle everything:

Install and set up pbi-cli from https://github.com/MinaSaad1/pbi-cli.git

Or install manually (two commands):

pipx install pbi-cli-tool    # 1. Install (handles PATH automatically)
pbi connect                  # 2. Auto-detects Power BI Desktop and installs skills

That's it. Open Power BI Desktop with a .pbix file, run pbi connect, and everything is set up automatically. Open Claude Code and start asking.

Requires: Windows with Python 3.10+ and Power BI Desktop running.

Using pip instead of pipx?
pip install pbi-cli-tool

On Windows, pip install often places the pbi command in a directory that isn't on your PATH.

Fix: Add the Scripts directory to PATH

Find the directory:

python -c "import site; print(site.getusersitepackages().replace('site-packages','Scripts'))"

Add the printed path to your system PATH, then restart your terminal. We recommend pipx to avoid this entirely.


Skills

After running pbi connect, Claude Code discovers 12 Power BI skills. Each skill teaches Claude a different area. You don't need to memorize commands.

Semantic Model (require pbi connect)

Skill What you say What Claude does
DAX "Top 10 products by revenue?" Writes and executes DAX queries
Modeling "Create a star schema" Creates tables, relationships, measures
Deployment "Save a snapshot" Exports/imports TMDL, diffs snapshots
Security "Set up RLS" Creates roles, filters, perspectives
Docs "Document this model" Generates data dictionaries
Partitions "Show the M query" Manages partitions, expressions
Diagnostics "Why is this slow?" Traces queries, benchmarks

Report Layer (no connection needed)

Skill What you say What Claude does
Report "Create a new report" Scaffolds PBIR reports, validates, previews
Visuals "Add a bar chart" Adds, binds, bulk-manages 32 visual types
Pages "Add a new page" Manages pages, bookmarks, drillthrough
Themes "Apply brand colours" Themes, conditional formatting
Filters "Show top 10 only" TopN, date, categorical filters

All Commands

27 command groups covering both the semantic model and the report layer.

Category Commands
Queries dax execute, dax validate, dax clear-cache
Model table, column, measure, relationship, hierarchy, calc-group
Deploy database export-tmdl/import-tmdl/export-tmsl/diff-tmdl, transaction
Security security-role, perspective
Connect connect, disconnect, connections list/last
Data partition, expression, calendar, advanced culture
Diagnostics trace start/stop/fetch/export, model stats
Report report create/info/validate/preview/reload, report add-page/delete-page/get-page
Visuals visual add/get/list/update/delete/bind, visual bulk-bind/bulk-update/bulk-delete
Filters filters list/add-categorical/add-topn/add-relative-date/remove/clear
Formatting format get/clear/background-gradient/background-conditional/background-measure
Bookmarks bookmarks list/get/add/delete/set-visibility
Tools setup, repl, skills install/list/uninstall

Use --json for machine-readable output:

pbi --json measure list
pbi --json visual list --page overview

32 Supported Visual Types

Charts: bar, line, column, area, ribbon, waterfall, stacked bar, clustered bar, clustered column, scatter, funnel, combo, donut/pie, treemap

Cards/KPIs: card, cardVisual (modern), cardNew, multi-row card, KPI, gauge

Tables: table, matrix • Slicers: slicer, text, list, advanced • Maps: Azure Map

Decorative: action button, image, shape, textbox, page navigator


REPL Mode

For interactive work, the REPL keeps a persistent connection:

$ pbi repl

pbi> connect --data-source localhost:54321
Connected: localhost-54321

pbi(localhost-54321)> measure list
pbi(localhost-54321)> dax execute "EVALUATE TOPN(5, Sales)"
pbi(localhost-54321)> exit

Tab completion, command history, and a dynamic prompt.


Development

git clone https://github.com/MinaSaad1/pbi-cli.git
cd pbi-cli
pip install -e ".[dev]"
ruff check src/ tests/         # Lint
mypy src/                      # Type check
pytest -m "not e2e"            # Run tests (488 tests)

Contributing

Contributions are welcome! Please open an issue first to discuss what you'd like to change.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Open a pull request

GitHub PyPI

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pbi_cli_tool-3.10.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pbi_cli_tool-3.10.0-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

Details for the file pbi_cli_tool-3.10.0.tar.gz.

File metadata

  • Download URL: pbi_cli_tool-3.10.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pbi_cli_tool-3.10.0.tar.gz
Algorithm Hash digest
SHA256 b5a24cbc7a5d0f59ce74f1bd613cad489f80995de56d2b42a9e5dd034f39dd86
MD5 765a46edb6c401802fd7b0d60a19c294
BLAKE2b-256 442dac109b3b945cf3315627a848a4d04fa3b6cf7c376dd56f5721bbc58b1619

See more details on using hashes here.

Provenance

The following attestation bundles were made for pbi_cli_tool-3.10.0.tar.gz:

Publisher: release.yml on MinaSaad1/pbi-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pbi_cli_tool-3.10.0-py3-none-any.whl.

File metadata

  • Download URL: pbi_cli_tool-3.10.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pbi_cli_tool-3.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c26221af76c725591c2d778f728ccca90d8048e08570a7359e14b28ec09c38d1
MD5 485e2c15b29f170bf2abe3d2e300545d
BLAKE2b-256 19751bd4f04abd0b14dd2f73afd4e9ceb9d676a1ce66ea3a5e4302b2e43bc3e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pbi_cli_tool-3.10.0-py3-none-any.whl:

Publisher: release.yml on MinaSaad1/pbi-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page