Power BI continues to evolve, offering powerful tools that enhance the data modeling and visualization experience. One of the latest additions to Power BI Desktop is the TMDL View (Tabular Model Definition Language), a feature currently in preview. This game-changing tool allows developers to script, modify, and apply changes to semantic models directly through code. In this blog, we'll dive deep into the functionalities of TMDL View, its benefits, and how you can leverage it to supercharge your Power BI projects.
What is TMDL?
TMDL offers a folder-based structure for managing your Power BI models, replacing the monolithic JSON file used by Tabular Model Scripting Language (TMSL). Instead of working with one large file, TMDL organizes your model into individual files for each table, perspective, role, and culture. This modular approach enhances clarity and simplifies collaboration, particularly for teams working on complex projects.
Key Benefits of TMDL:
- Improved Collaboration: Multiple developers can work on different parts of the model simultaneously without stepping on each other's toes.
- Enhanced Source Control: Easier to track changes, manage versions, and resolve merge conflicts using tools like Git.
- Simplified Model Management: Quickly locate and edit specific components of your model without sifting through a massive JSON file.
Enabling TMDL in Power BI
To get started with TMDL, youโll need to enable it in the Preview features of Power BI Desktop:
- Open Power BI Desktop
- Navigate to File > Options and settings > Options
- Under Preview features, check the box next to "TMDL VIEW"

Once the preview feature is enabled, the TMDL view tab will appear on the left side of the Power BI Desktop window:

Exploring Semantic Model Metadata
Even if you're not looking to modify your semantic model, TMDL View is a powerful tool for exploring and understanding model metadata. You can explore any particular measure, column, table or complete Semantic Model. You can either drag and drop the field to the space or simply right click on it and select script tab

By clicking on this you wil be able to see the complete summary of the field as below

Boosting Development Efficiency
TMDL Viewโs code editor isnโt just for scriptingโitโs a comprehensive development environment. Key features include:
- Semantic Highlighting: Easily distinguish between different elements in your code.
- Expand/Collapse: Navigate complex scripts with ease.
- Error Diagnostics: Quickly identify and resolve issues.
- Autocomplete: Speed up scripting with intelligent code suggestions.
For example, if you need to remove prefixes like "dim_" or "fact_" from all your tables, you can script the full model, search for these prefixes using regular expressions, and replace them in bulk.
Applying and Managing Changes
Once your scripts are ready, simply click the Apply button to execute the changes. Successful changes trigger a confirmation notification, while errors prompt a detailed diagnostic message, guiding you through troubleshooting steps.
Itโs important to note that TMDL View only modifies semantic model metadataโit doesnโt refresh data or impact report visuals unless those changes directly affect them. For example, renaming a field might break existing visuals that rely on that field.
Use Cases:
TMDL view isn't just about scripting; it's about transforming how you manage and interact with your semantic models. Here are some practical use cases:
1. Bulk Move Measures into a Folder
Organize your measures effortlessly by scripting them into specific folders, enhancing model clarity and navigation.
2. Update M-Code Without Query Editor
Modify your Power Query M-code directly through TMDL scripts, bypassing the query editor for quicker updates.
3. Change Data Types
Easily adjust the data types of your columns using simple TMDL commands, ensuring consistency across your model.
4. Update Summarization at Once
Apply summarization changes to multiple columns simultaneously, saving time and reducing manual errors.
5. Find and Replace
Use the search-and-replace functionality to quickly update naming conventions or correct errors across your model.
6. Switch Between Import and Direct Query
Toggle your data connection modes from Import to DirectQuery or vice versa using TMDL scripts.
7. Import and Collaborate Using TMDL Scripts
Share your TMDL scripts with colleagues via email or platforms like SharePoint, promoting collaborative development.
8. Create Calendar Tables and Calculation Groups
Generate calendar tables and calculation groups directly in TMDL, streamlining time intelligence functions.
9. Utilize Multiple Cursors
Speed up your coding process with multiple cursors, allowing simultaneous edits in different parts of your script.
In upcoming blogs we will share detail about each use case in detail.
Conclusion
TMDL View in Power BI Desktop is a powerful addition that opens new doors for developers and analysts alike. Whether you're looking to enhance efficiency, improve model transparency, or collaborate seamlessly with your team, TMDL View offers the tools you need.
Stay ahead of the curve by enabling this feature today and exploring its vast potential. And donโt forgetโweโd love to hear your thoughts and experiences! Share your feedback through the Power BI Community and help shape the future of Power BI.
Ready to dive in? Enable TMDL View in Power BI Desktop and start scripting your way to more efficient data models!
Proud to be a Microsoft Fabric community super user
Let's Connect on LinkedIn
Subscribe to my YouTube channel for Microsoft Fabric and Power BI updates.