TL;DR: Semantic models in Fabric and Power BI can be represented as plain text files called TMDL. That means GenAI agents can read, write, and extend your models — generating measures, calculation groups, and entire refactors in seconds. Here’s how to set it up.
If you work with semantic models in Microsoft Fabric or Power BI, you need to know about TMDL files.
TMDL (Tabular Model Definition Language) is a human-readable, text-based format that describes semantic model objects — tables, measures, relationships, calculation groups, and more.
The important bit is that text-based means GenAI agents can work with it.
How I discovered this
When you connect a Fabric workspace to Git (Azure DevOps or GitHub), semantic models are serialised into a folder structure that includes .tmdl files inside a definition/ directory. Microsoft documents the format here.
This means your semantic model — tables, measures, relationships, partitions — lives as readable code in your repo. And anything that can read and write text files can now participate in building your model.
Two workflows
Workflow 1: Fabric → Git → GenAI agent
This is the most direct path.
- Connect your Fabric workspace to Git. Follow Microsoft’s guide to getting started with Git integration. You’ll need a Fabric capacity and the relevant tenant switches enabled.
- Clone the repo locally. Your semantic model folder will contain a
definition/subfolder with.tmdlfiles — one per table, plus files for relationships, roles, expressions, and model metadata. - Point a GenAI agent at it. Open the repo in Claude Code, VS Code with Copilot, or any AI coding assistant. The agent can read the existing model structure and generate new measures, tables, calculation groups, or even entire model refactors.
- Commit and sync. Push the changes back to Git, and Fabric syncs them into your workspace.
Bonus 1: Document your wider data estate (lakehouses, warehouses, external sources) as markdown files in the same repo. This gives the agent context beyond the semantic model — making it far more effective at suggesting joins, new tables, or measures.
Bonus 2: Give the agent MCP tooling to query tables with SQL directly. Instead of working from static documentation alone, it can inspect live schemas and sample data — leading to more accurate and grounded suggestions.
Workflow 2: GenAI agent → TMDL scripts → Power BI Desktop
This path doesn’t require Fabric Git integration at all.
- Create a project folder with a markdown file describing your data — table names, column names, data types, relationships, business rules. The more schema context, the better.
- Ask the agent to generate
.tmdlfiles. Claude, Gemini, or any capable model can produce valid TMDL given the TMDL specification. This works for measures, calculated columns, calculation groups, and table definitions. - Paste the scripts into Power BI Desktop’s TMDL view. This is a preview feature that lets you script, modify, and apply changes to semantic model objects directly in code.
Enabling the TMDL view preview in Power BI Desktop
TMDL view is currently a public preview feature and must be enabled manually:
- Open Power BI Desktop
- Go to File → Options and Settings → Options
- Navigate to Preview features
- Check TMDL View
- Restart Power BI Desktop
Once enabled, a new TMDL view icon appears in the left sidebar. You can script objects, paste in externally generated TMDL, and apply changes directly to the model. Microsoft’s deep dive blog post covers the full capabilities.
Why this matters
Up until now, building out a semantic model meant clicking through a GUI — creating measures one at a time, editing calculation groups one at a time, wiring up relationships one at a time. It’s a pain in the ass.
TMDL changes this so that the model is now text. Which means:
- Batch operations. Need 30 measures across 5 tables? Describe the pattern once and let an AI agent generate all of them. No more repetitive point-and-click.
- AI with full context. The agent isn’t working blind. It can see your existing tables, relationships, and measures in the
.tmdlfiles — and if you add markdown docs for your lakehouse or warehouse tables, it has context across your entire data estate. That context is what makes the output actually useful. - Scalable model development. Calculation groups, perspectives, translations, role-based security — things that are tedious to configure manually become a generation task. Describe what you want, review the output, apply it.
This doesn’t directly replace the GUI, that’s still where validation happens. But it does provide a way to use GenAI tools to support Power BI development in a far more integrated way.
Key links
- TMDL overview (Microsoft Learn)
- Fabric Git integration source code format
- Getting started with Fabric Git integration
- TMDL view in Power BI Desktop (Microsoft Learn)
- Deep dive into TMDL view (Power BI Blog)
- Why Power BI developers should care about TMDL (Endjin)
- Edit semantic models in the Power BI service