Power BI as code: from .pbix to production
Moving reports from .pbix to PBIP, versioning them on GitHub and developing with Claude Code – with a controlled path into production in Power BI Service.
On this page
Starting point
Reports lived as binary .pbix files on a shared drive. There was no way to see what changed between two versions, who changed it or why. Publishing was manual from Power BI Desktop – and what was in production didn’t necessarily match any file.
Approach
From .pbix to PBIP
I converted the reports to the PBIP format: the report as PBIR, the data model as TMDL. A single binary file became a set of readable text files that can be compared line by line.
The structure of one report after conversion (simplified):
Sales.pbip
Sales.Report/
└── definition/
├── report.json
└── pages/
└── overview/page.json
Sales.SemanticModel/
└── definition/
├── model.tmdl
├── relationships.tmdl
└── tables/
└── Sales.tmdl
Taking over each report follows a fixed procedure: first the untouched original is committed to Git, only then come the changes. Every change against the original version is visible.
GitHub as the single source of truth
- The repository mirrors the workspace structure in Power BI Service – where a report sits in the repo, that’s where it lives in production.
- A shared brand and a template for new reports: date table, culture, model conventions, a ready-made measure structure.
- Old
.pbixfiles are kept only as an archive. - No data or credentials in the repository – an automated check guards it.
Claude Code on top of the repository
Because reports are text, an AI agent can work with them. To make it predictable, it has:
- an operating manual – design standard, model conventions, known traps and Git rules,
- repeatable workflows – new report, takeover and redesign, small change, model audit, impact analysis,
- roles – the analyst maps, the builder executes, the reviewer independently checks.
The agent saves or publishes nothing without approval. A human always makes the call.
An agent’s report is a claim, not proof. Results are always verified – in the code diff and in the numbers.
A controlled path to production
- Publishing goes from the repository straight to Power BI Service via the REST API.
- Reports are overwritten in place, so links, permissions, owner and gateway settings are preserved.
- Nothing that isn’t committed and pushed to Git can be published. No “version from my laptop”.
- Deployment is followed by a refresh and a check that it succeeded.
From requirements to verified numbers
A new report starts with requirements and a map of sources in the data warehouse. Before building, reference KPI values are computed from the data, and before launch the report’s numbers are compared against them.
Outcome
- Every report change has a history – it can be traced, compared and reverted.
- Production matches what’s in the repository.
- One look and feel across the group’s reports.
- New reports start from a template and ship with verified numbers.
Examples are anonymised – no company data or names.