top of page

TMDL Scripting in Power BI

  • mandarp0
  • Feb 7
  • 3 min read

Updated: Sep 4

Power BI continues to evolve, bringing innovative tools to enhance the efficiency of semantic modeling. One of the most exciting advancements is TMDL View, a new scripting-based feature in Power BI Desktop that allows users to modify and apply changes to the semantic model using Tabular Model Definition Language (TMDL). This feature introduces a modern code editor, giving developers more control, transparency, and efficiency in managing semantic model metadata. 

What is TMDL View? 

TMDL View in Power BI Desktop offers an alternative way to build and modify semantic models. Unlike the traditional Model View, which relies on a graphical user interface (GUI), TMDL view enables scripting-based modifications, making it easier for developers to apply complex changes, reuse scripts, and collaborate efficiently. 

With TMDL View, users can: 


  • Script, modify, and apply changes directly in a code editor. 

  • Enhance development efficiency with features such as search-and-replace, keyboard shortcuts, and multi-line editing. 

  • Increase reusability by sharing TMDL scripts among teams. 

  • Gain more control and transparency, revealing all semantic model properties, including those not exposed in the GUI. 


Key Benefits of TMDL Scripting 

Boost Development Efficiency 

TMDL View is designed for power users who prefer coding over clicking. With a feature-rich modern code editor, users can streamline their workflow using: 


  • Syntax highlighting and IntelliSense for easier script writing. 

  • Keyboard shortcuts and multi-line editing for rapid changes. 

  • Search and replace capabilities for quick modifications. 


Enhance Reusability and Collaboration 

One of the biggest advantages of TMDL scripting is the ability to script, share, and reuse TMDL code. This is especially useful for: 


  • Standardized objects such as calendar tables and time intelligence calculation groups. 

  • Team collaboration, where scripts can be stored in a centralized SharePoint site or version-controlled repository. 

  • Consistent modeling, ensuring that different teams follow best practices when working with semantic models. 


Gain More Control and Transparency 

TMDL View provides access to all semantic model objects and properties, including those not available in the Power BI Desktop GUI. Developers can modify: 


  • IsAvailableInMDX – Enables or disables objects for MDX queries. 

  • DetailRowsDefinition – Controls row-level details for tables. 

  • Calculation groups and perspectives, fine-tuning model behavior beyond UI limitations. 



How to Get Started with TMDL View 

Go to File > Options and settings > Options > Preview features and check the box next to TMDL View 

Script any semantic model object such as table, measure, column, or perspective by selecting the objects from Data pane and dragging them into the code editor:

ree

TMDL view will script the selected objects as a TMDL script and just like TMDL in VS Code you get an enriched code experience with features such as semantic highlighting, error diagnostics and autocomplete.  


ree

You may change any valid property or object within the semantic model. For instance, how to modify the display folder property and detail rows definition of multiple measures. 

When ready you can hit the Apply button to execute the TMDL script against the semantic model to get your changes applied. 


ree

When successful, an instant notification will be displayed, and your modeling change will be applied to the semantic model. 

In the event of a failure, your modeling changes will not be applied to the semantic model, and you can view more information about the error by clicking on show details, which expands the Output pane with the error details. 


Conclusion 

TMDL View is a game-changer for Power BI semantic modeling, offering a scripting-first approach that improves efficiency, reusability, and control. By leveraging TMDL scripting, Power BI developers can streamline their workflows, standardize modeling practices, and unlock capabilities beyond the graphical UI. 

As Power BI continues to evolve, adopting TMDL scripting will empower teams to build more efficient, scalable, and transparent semantic models. Start exploring TMDL View today and take your Power BI development to the next level! 

For expert data solutions tailored to your business, contact us at Numlytics. Transform your data into actionable insights!

 
 
 

Comments


bottom of page