In January 2025, Power BI Desktop introduced an exciting new feature to preview: the Tabular Model Definition Language (TMDL) scripting experience. This enhancement is part of Power BI’s commitment to empowering data professionals with tools that streamline workflows and improve the semantic modeling process.
What is TMDL?
TMDL, or Tabular Model Definition Language, is a structured, text-based format that describes the semantic model of a Power BI report. This includes tables, columns, relationships, measures, and other objects that define how data is organized and analyzed. While Power BI’s graphical interface has always provided a way to build and manage these models, TMDL takes it a step further by introducing a scripting approach that offers greater control and flexibility.
How Does TMDL Scripting Work?
Enabling the TMDL scripting experience is straightforward:
- Navigate to File > Options and settings > Options > Preview features.
- Check the box for TMDL View and restart Power BI Desktop.
Once enabled, you can:
- Open a new TMDL View from the ribbon.
- Drag and drop semantic model objects (e.g., tables, measures, hierarchies) into the TMDL editor to generate the corresponding script.
- Use the rich code editor to make changes, supported by features like syntax highlighting, search-and-replace, and keyboard shortcuts.
- Apply your changes to the model by clicking the Apply button, instantly updating the semantic model.
Key Advantages of TMDL Scripting
The introduction of TMDL scripting is a game-changer for data professionals. Here’s why:
- Enhanced Development Efficiency: The TMDL editor streamlines complex modeling tasks. Features like multi-line editing and bulk find-and-replace make it easier to manage large models and repetitive updates.
- Improved Reusability: TMDL scripts can be saved, shared, and reused, allowing teams to standardize components such as date tables or calculation groups. This is particularly useful for organizations that rely on consistent modeling practices across multiple reports.
- Greater Control and Transparency: With TMDL, every property of a semantic model object is exposed, including advanced configurations like
IsAvailableInMDXorDetailRowsDefinitionthat are not accessible through the GUI. This level of detail enables fine-tuned optimizations and customizations. - Seamless Collaboration: By integrating with source control systems, TMDL supports versioning and collaborative development. Teams can track changes, merge updates, and maintain a history of their semantic model modifications.
- Empowering Advanced Use Cases: For developers comfortable with scripting, TMDL opens up opportunities for automation and integration. For instance, you can generate scripts programmatically or use them as templates for similar projects.
Practical Use Cases
Here are some scenarios where TMDL scripting shines:
- Standardizing Date Tables: Save a TMDL script of a calendar table with pre-defined columns, hierarchies, and relationships. Reuse it across multiple projects to ensure consistency.
- Bulk Edits to Measures: Use search-and-replace in the TMDL editor to update measure definitions across an entire model in seconds.
- Advanced Customizations: Add properties like
DetailRowsDefinitionthat are not exposed in the graphical interface, optimizing the user experience for report consumers. - Version Control and Auditing: Track changes to your semantic model over time, ensuring transparency and accountability in collaborative environments.
Getting Started with TMDL
If you’re new to scripting or hesitant to leave the comfort of the GUI, don’t worry—TMDL scripting is designed to complement, not replace, the graphical interface. Start by:
- Enabling TMDL View and experimenting with small changes.
- Reviewing the generated scripts to understand the structure and syntax.
- Gradually incorporating TMDL into your workflow for tasks like bulk updates or advanced customizations.
Conclusion
The TMDL scripting experience in Power BI Desktop is a powerful tool for data professionals, offering enhanced efficiency, flexibility, and control over semantic modeling.
While TMDL might not be suitable for all users as it requires some scripting knowledge, it is undoubtedly a step in the right direction to make modeling in Power BI Desktop more flexible, reusable, and robust.




