Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 TMDL Skill — Power BI Semantic Model Assistant

A Claude AI skill + interactive tool that helps beginners, intermediate, and senior developers work with TMDL (Tabular Model Definition Language) in Power BI.


What's TMDL?

TMDL is Power BI's text-based format for defining semantic models. Instead of a binary .pbix, your model lives as a folder of readable .tmdl files — one per table, plus relationships, roles, and more. This unlocks Git version control, code review, and full CI/CD automation.

It's powerful. But the learning curve is steep, documentation is sparse, and most BI professionals come from a GUI-first world. This skill + tool bridges that gap.


What's in This Repo

tmdl-skill/
├── README.md                    ← You are here
├── SKILL.md                     ← Claude skill: syntax reference for all levels
├── artifact/
│   └── TMDL_Assistant.jsx       ← AI-powered React tool (runs in Claude.ai)
├── examples/
│   ├── model.tmdl               ← Model-level settings template
│   ├── database.tmdl            ← Database/compatibility settings
│   ├── tables/
│   │   ├── Sales.tmdl           ← Full table example with measures + partition
│   │   ├── Customer.tmdl        ← Dimension table example
│   │   └── Date.tmdl            ← Calculated date table
│   ├── relationships.tmdl       ← Relationship definitions
│   └── roles.tmdl               ← RLS role examples
└── docs/
    └── getting-started.md       ← Quick start guide for Power BI Desktop sync

The Skill (SKILL.md)

A structured reference that teaches Claude how to work with TMDL at three levels:

Level What it covers
🟢 Beginner Folder structure, syntax rules, common errors, first steps with PBI Desktop
🟡 Intermediate Measures with complex DAX, RLS, incremental refresh, display folders
🔴 Senior CI/CD pipelines, PowerShell TOM deployment, Python TMDL generation, Git workflows

Install in Claude.ai → Settings → Claude Skills → Upload .skill file.


The Tool (TMDL_Assistant.jsx)

An AI-powered artifact built with React + Claude API. Four modes:

Mode What it does
⚡ Generate Describe your model → get production-ready TMDL files
📖 Explain Paste TMDL → plain-English breakdown at your level
🛡️ Validate & Fix Paste TMDL → ERROR/WARNING/INFO list + corrected code
🚀 CI/CD Describe your scenario → working deployment scripts

How to use it:

  1. Open Claude.ai
  2. Create a new artifact → paste the contents of artifact/TMDL_Assistant.jsx
  3. Run it — the tool calls the Claude API automatically

Quick Start

Power BI Desktop → TMDL

  1. Open Power BI Desktop
  2. File → Options → Preview Features → enable Store semantic model using TMDL format
  3. File → Save As → TMDL Folder
  4. Open the folder in VS Code (install the TMDL extension)

Validate before you deploy

# Using Tabular Editor CLI
dotnet tool install -g TabularEditor.CLI
te validate ./model --check-aff

Deploy to a Premium/Fabric workspace

# See examples/deploy.ps1 for the full script
te deploy ./model `
  --xmla "powerbi://api.powerbi.com/v1.0/myorg/YourWorkspace" `
  --client-id $env:PBI_CLIENT_ID `
  --client-secret $env:PBI_CLIENT_SECRET `
  --tenant-id $env:PBI_TENANT_ID `
  --overwrite

TMDL Syntax Cheatsheet

table Sales
  lineageTag: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

  column SalesAmount          ← 2-space indent (tabs will break parsing)
    dataType: decimal
    lineageTag: ...
    formatString: \$#,0.00
    summarizeBy: sumuse "none" on ID/key columns
    sourceColumn: SalesAmount

  measure Revenue =            ← = must end the declaration line
      SUM(Sales[SalesAmount])  ← DAX indented 4 more spaces
    lineageTag: ...
    formatString: \$#,0.00
    displayFolder: KPIs

  partition Sales = m
    mode: import
    source =
      let Source = ... in Source

Critical rules:

  • ✅ 2 spaces indentation — never tabs
  • ✅ Names with spaces must be 'single quoted'
  • ✅ Every object needs a unique lineageTag GUID
  • ✅ LF line endings (not CRLF)

Contributing

PRs welcome. Especially looking for:

  • Additional TMDL examples (DirectQuery, Fabric, composite models)
  • CI/CD templates for Azure DevOps
  • pbi-tools workflow examples

License

MIT — use it, adapt it, share it.


Built with Claude Sonnet · Designed for the Power BI community

About

Claude AI skill + interactive tool for Power BI TMDL — generate, explain, validate & deploy tabular models. Covers beginners to senior developers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages