Power BI is Finally Code: Automating Semantic Model Governance via TMDL
Thebitoolbox
3 min read22 hours ago
—
Press enter or click to view image in full size
For years, Enterprise Business Intelligence felt like a black box. You built complex architectures, optimized DAX measures, and defined Row-Level Security—but it was all trapped inside a proprietary, binary file format. Documentation was a nightmare.
If you asked a Data Engineer how they managed version control or automated metadata extraction in Power BI two years ago, they would probably sigh and mention bulky XMLA endpoints or fragile third-party macros.
But Microsoft recently changed the game. By introducing Developer Mode (.pbip) and the Tabular Model Definition Language (TMDL), Power BI semantic models are no longer UI-locked black boxes.
They are finally just text. And text can be parsed, audited, and automated.
The Problem with Traditional BI Governance
In most corporate environments, documenting a semantic model is a purely manual, soul-crushing task.
When a developer finishes building a report, they are expected to open a Word document or a Confluence page and manually type out every table name, relationship, and core DAX measure.
By the time the ink is dry on that documentation, the business has already requested three new measures and a schema change. The documentation becomes obsolete instantly, leading to massive technical debt and the dreaded “Spaghetti Models” that nobody wants to inherit.
Enter TMDL: The Gateway to Automation
TMDL represents the semantic model using a highly readable, YAML-like syntax. Every table, column, hierarchy, partition, and relationship is stored as a lightweight text file in your local directory.
This shift unlocks a massive opportunity for BI Developers: Zero-Touch Governance.
If the entire architecture of a Power BI model is defined in text, you no longer need to reverse-engineer the .pbix file. You don’t need to manually trace bidirectional relationships or write complex DMVs (Dynamic Management Views) against a live workspace.
Get Thebitoolbox’s stories in your inbox
Join Medium for free to get updates from this writer.
Remember me for faster sign in
You just need a parser.
Automating the Audit: How It Works
Instead of manual data entry, the modern governance workflow relies on reading the TMDL structure directly.
By pointing a script or a parsing engine at the .pbip directory, you can programmatically extract:
The core topology: A complete list of fact and dimension tables, including hidden columns and metadata descriptions.
DAX dependencies: Exact measure definitions, ensuring that logic isn’t hidden away in obscure folders.
Relationship mapping: Detecting cross-filter directions (identifying risky bidirectional filters) and active/inactive states.
Security definitions: Extracting Row-Level Security (RLS) roles to ensure compliance before deployment.
Once parsed, this raw metadata can be fed back into an automated Data Dictionary dashboard—essentially using Power BI to document Power BI.
Moving from Manual Labor to Engineering
As data professionals, our time is too valuable to be spent copying and pasting DAX formulas into spreadsheets. The transition to .pbip and TMDL allows us to treat BI development with the same rigor as traditional software engineering.
I built the ModelLens framework specifically to bridge this gap. It acts as an automated parsing engine that reads your local TMDL files and instantly generates an enterprise-grade Model Audit and Data Dictionary. No manual entry, no obsolete documentation.
If you are managing complex, enterprise-scale Power BI environments, it is time to stop documenting and start parsing.
⚙️ Ready to implement automated, code-based governance in your workflow?
Explore the ModelLens architecture and audit your first model in seconds here.
