Five ways that the TMDL view can help you be more productive in Power BI

The TMDL view is a new feature in Power BI Desktop that has a lot of potential. This feature lets you directly change model metadata without dependency on the user interface of Power BI Desktop. By making changes to the model metadata directly, you can scale your tasks within a model to be more efficient and do things that previously weren’t possible without third-party tools.  

If you want a complete introduction to the TMDL view and how to use it, we recently released a free course that you can follow via Tabular Editor Learn. However, if you just want a short overview of some ways that this feature can save you time, we list out five use-cases in this short article. This article is just meant to get the gears turning in your mind, so that you can see the value in the TMDL view for your own scenarios. 

The TMDL view in a nutshell

The TMDL view is a separate view in Power BI Desktop, like the DAX Query view, the report canvas, and so on. To use the TMDL view: 

Step 1: Ensure that it’s enabled from the preview features in Power BI Desktop. 

Step 2: Navigate to the “TMDL view” on the left-hand side of the user interface. 

Step 3: Select one or more objects in your model (tables, columns, measures) from the data pane or the “semantic model” pane. 

Step 4: Click and drag these objects onto the TMDL canvas to make a new script. 

Step 5: Make changes to the metadata and click “preview” to see your changes. Check for any unexpected changes highlighted in that preview “diff” on the right. 

Step 6: Apply your changes to the model.  

In addition to the above, you might also consider using the TMDL view in combination with other tools, like Tabular Editor 3 (which can generate TMDL scripts) or VS Code (which can open TMDL scripts from a Power BI Project and use GitHub Copilot): 

Five ways that the TMDL view can help you be more productive in Power BI_fig_1

Five ways that the TMDL view can save you time

Here’s a quick overview of five example use-cases for the TMDL view, when you use Power BI Desktop: 
Five ways that the TMDL view can help you be more productive in Power BI_fig_2
#1: Make multiple changes at once

The most obvious and simple way that the TMDL view can be useful for you is that you can make multiple changes at once. Importantly, to do this, you must know the basics of how to read and interpret TMDL metadata. Thankfully, TMDL is elegantly structured, making it easy to read and change, even for novice or intermediate users of Power BI. 

This is important to emphasize: The TMDL view is so simple and straightforward that it’s accessible to a wide range of Power BI users… not just experts! This feature is an on-ramp for enhanced productivity for anyone who works in Power BI. They just need to know when to use it and why it can be helpful for them. 

Since you are just working with metadata as text, you can use various text / code editor tools and shortcuts to streamline these changes. Here are some simple examples: 

  • Find-and-replace. You can press Ctrl + F to search a script for text (strings and sub-strings). This can be useful when you are checking for measure references, functions, or key words, or if you want to replace these (sub)-strings with other values.  
  • Multi-cursor editing. While your cursor is active in the TMDL script, you can hold Alt and select another part of the script to create a second cursor. You can do this multiple times to edit multiple parts of the script at once, rather than performing a find-and-replace. Further, you can also press Ctrl + D to select the next occurrence of a word at the cursor, or Ctrl + Shift + L to select all occurrences. These shortcuts also work in the Power BI Desktop DAX formula bar. 
  • Bulk-changing properties or expressions. Using either multiple cursors, find-and-replace, or other approaches (like generative AI), you can change the same property for many objects.   

Think about using the TMDL view for this use-case in the following scenarios: 

  • You must make simple changes across many measures, columns, or tables at once. 
  • You want to search the whole model for a field, function, pattern, or comment (like “TODO”). 
  • You want to make changes while viewing or changing multiple measures or properties, at once. 
#2: Use features or properties that don’t have a user interface in Power BI
We discussed this in a previous article, but there are many features and properties in Power BI that aren’t supported by the user interface. Developing a user interface to support these things takes time and priority which Microsoft doesn’t necessarily have, so users needed to rely on third-party tools, instead. However, it’s now simple to change these properties via the TMDL view, notebooks, or even VS code. 
Five ways that the TMDL view can help you be more productive in Power BI_fig_3

You can use the TMDL view whenever you want to leverage these properties, and aren’t using third-party tools, either due to preference or organizational restrictions. Here are some simple examples: 

  • Model collation or compatibility level. In Fabric, Direct Lake models  on SQL are case-sensitive, because they use a case-sensitive collation (this doesn’t apply to the new Direct Lake on OneLake storage mode; for an overview of these modes see this SQLBI article). Depending on your data, you might want to use a case- insensitive collation to avoid unexpected results that business users perceive as incorrect. 
  • Object-level security. If you want to set specific read permissions for columns or even measures in your model, you can set up OLS. OLS can be helpful when people re-use semantic models to make their own reports and analyses, since it hides the objects that people don’t have permissions to view and query. 
  • Properties like IsPrivate or IsAvailableInMDX. Only a small subset of object properties are shown in the user interface in Power BI. There are many other properties that you can use for various purposes; IsPrivate will hide a table from client tools, while IsAvailableInMdx will make columns occupy less memory, but make them inaccessible to MDX queries from tools like Analyze-in-Excel. 

Note that you don’t need to use these properties; they often come up when you have a specific requirement or scenario that they would support. 

#3: View or edit Power Query (M code) without opening the query editor
Power BI Desktop is a big tool that can do a lot of things. Consequentially, it can be a bit heavy, and some operations take a lot of time to complete. When you need to check or search for things in your model, this can cost you a lot of time over the lifecycle of a project or a model. An example of this is when you transform data in Power Query, and you regularly must open the query editor to check or change transformations. 
Five ways that the TMDL view can help you be more productive in Power BI_fig_4

In the TMDL view, you can view these transformations for table partitions much quicker and more conveniently than using the query editor. 

Here are some simple examples: 

  • Checking Power Query changes. There are times when you want to check a transformation step, a referenced column, or a variable. This could be to inform other changes, when you are performing QA/QC on a model, and so forth. 
  • Re-using Power Query. You might want to re-use certain Power Query transformations in the same model or another model. Being able to quickly retrieve existing steps or patterns can therefore be useful. 
  • Formatting Power Query (M code). You can leverage generative AI to generate and format Power Query expressions in table partitions. We discuss this further below. 

Note that when you use the TMDL view for Power Query, you accept the following caveats: 

  • There is no syntax highlighting, code assistance, or validation for Power Query. 
  • You can’t view expressions or custom functions (i.e. tables set to “do not load”). 
#4: Making changes by using generative AI

A common use-case of generative AI is to help you make changes to code and text, such as TMDL metadata. Since TMDL scripts are saved in a Power BI Project file, it is easy to open them in VS Code and make changes via GitHub Copilot. Here, you can prompt the tool to make various changes or additions to your model, including names, properties, and code. Note however that you will only see and validate these changes once you open the Power BI Project in Power BI Desktop.  

Here are some simple examples: 

  • Model metadata translations (cultures). An efficient way to translate your model is to get AI to suggest the metadata translations for one or more languages, based on one or more examples. Then, you can validate these translations either manually or by using a second model, or a more precise tool.  
  • Suggesting descriptions. Descriptions are important for both human and AI users of your model, such as Copilot, Fabric Data Agents, and custom AI solutions to consume the model. An efficient way to create descriptions is to get AI to suggest them, and then refine or correct these suggestions, manually. 
  • Generating, optimizing, or refactoring code (within reason). If you script your entire model, then you can use it as context to ask questions to an LLM. You might ask to suggest improvements, find bottlenecks, or even suggest changes to code or new measures. However, you should always be very careful with this approach, since AI tools can introduce unexpected changes, make hallucinations, or produce suboptimal results. In general, this is something you would explore in simple scenarios where you have many trivial tasks, rather than complex scenarios where there’s larger, multi-faceted problems. 

Note that AI models aren’t trained on very much TMDL data, since the TMDL format is relatively new. Therefore, you should make sure that you provide ample examples to an LLM if you want it to generate TMDL or make significant changes to your script.

#5: Re-using static templates
You typically want to re-use as much of your models and reports as possible in future work. This means that you follow the principles of atomic design, and take steps to create and use templates in a repeatable and sustainable way. TMDL scripts are one modality to do this for static templates, meaning templates that do not have dynamic or parameterized elements that change depending on the target model. 
Five ways that the TMDL view can help you be more productive in Power BI_fig_5

There are other ways to save and re-use templates, including dynamic templates: 

  • C# scripts in Tabular Editor.  
  • Notebooks in Fabric that use semantic link or semantic link labs. 
  • Custom or proprietary programmatic solutions or tools that leverage APIs and metadata. 

Templates are one of the most valuable assets in your Power BI ecosystem. Here are some simple examples: 

  • Date tables. Date dimension tables are one of the most common and standard elements in a semantic model. They are also very important. Irrespective of whether your date table comes from a data source, Power Query, or DAX, you can save a TMDL script for it which ensures that you have not only the table, but also its properties (like custom sorting of columns) and organization of the columns into display folders. 
  • Last refresh tables. A common request for users is to display the freshness of the data; when was it last refreshed? This can be done with a simple Power Query expression (in import models) that reports the current server date, updated at model process time. A TMDL script can repeat this standard pattern, including formatting the date and a measure to report it in a card of your Power BI report. 
  • Static or “master model” patterns. Patterns like pPareto analyses or even certain DAX conditional formatting patterns can be useful to re-use across models. 

Irrespective of the approach you choose, it is most important that you actively and regularly look for opportunities to create and use templates in your work. 

In conclusion

The TMDL view is a powerful new tool that can help you scale tasks when you develop a semantic model. It’s a useful and easy way to make changes in bulk or access parts of the model that weren’t possible before without third-party tools. Furthermore, it helps to familiarize users with model metadata and also approaches that work beyond the user interface for enhancing productivity and development, so that they can leverage other tools like notebooks, C# scripts in Tabular Editor, and more.  

This article introduces just five possible use-cases… there are more! If you want to learn the ins-and-outs of the TMDL view, check out our free course via Tabular Editor Learn. 

Related articles