Save time in Power BI with TMDL (2025)

With TMDL, we can directly edit the semantic model of a report in Power BI Desktop as code. This is interesting for developers but also highly suitable for low-code analysts looking to reduce repetitive tasks.

Personally, I expect a lot from this functionality in the near future, as TMDL allows editing the semantic model as code. This makes it possible to enhance the model using AI tools like Copilot or ChatGPT.

This blog will cover the following topics:

  1. Activating TMDL
  2. TMDL view structure
  3. Searching and copying in the semantic model
  4. Bulk changes in the semantic model
  5. Git version control

1. Activating TMDL

In 2025, TMDL is still in preview mode, so you need to activate it manually. Here’s how:

  1. Go to the top left and click on File
  2. Then select Options and settings
  3. Dan Options
  4. Under Preview features, scroll to the bottom and check TMDL view

After restarting Power BI Desktop, you will see the TMDL view option on the left.

2. TMDL view structure

You can view objects in TMDL by dragging them into the editor. Examples include:

  • A single measure
  • Multiple measures or other objects (hold CTRL to select multiple objects)
  • The entire semantic model

The following example shows a measure which was dragged into the TMDL editor, displaying sales exclusively for the United States. It is formatted in US dollars. Additional properties such as a display folder or description are not shown but can be added in this editor.

3. Searching and copying in the semantic model

By clicking Model on the right hand side, you can drag the entire semantic model into the editor. This provides several advantages:

  • You can easily search for a specific measure using CTRL+F and see exactly where it is used.
  • Frequently used tables, calculation groups, or measures (such as time intelligence measures) can be easily copied into a new report. This ensures standardized formatting and consistent calculations across all reports.
  • If a definition changes within your organization or a different formatting is required, you can easily update it across the entire model.

4. Bulk changes in the semantic model

Some modifications in Power BI can be time-consuming, such as adding descriptions to every measure. Especially since Power BI takes time to load after every single description you fille in. In TMDL, you can do this for all measures at once without having to wait for Power BI to load.

When in TMDL view, click on Model in the Data pane on the right-hand side. Select all measures by opening the items under the Measures header, selecting the first one, and then selecting the last one while holding the SHIFT key. If you do not want to select all measures, you can make your own selection by holding the CRTL key and clicking on the desired measures. Then, drag and drop the Measures to the TMDL view.

Now, you can easily add descriptions for all measure at once by placing a comment line with “///” above each measure. After adding the descriptions, click Apply to push your changes and update the measure descriptions.

When you open the measure in Model view, you will see that a description has been added.

This approach allows you to update all properties at once, including formatting, names, and calculations. Or, if you’re working with dozens of measures and don’t feel like doing it yourself, you can be lazy and let an AI tool of your choice (like ChatGPT, Claude or Copilot) insert the descriptions into the TMDL code for you. This can be done by:

  • Copying the syntax of the TMDL view after dragging the measures into it.
  • Pasting it in your AI tool of choice
  • Adding the following prompt (This prompt works really well for me):
You are a Power BI prompt engineer. You will receive Power BI TMDL code containing DAX measures. For each measure definition, insert a human-readable, concise, and descriptive comment about what the measure does. The comment must be inserted in a new row above each “measure” line. Each comment must begin with ///. Write the comment in English using clear business language suitable for business analysts. Only comment on actual measures (lines starting with measure), not calculated columns or anything else. Do not alter the DAX formulas themselves. Do not remove or rearrange any existing code. Focus on clarity, accuracy, and business context.
Use this format:
/// [Concise description of what the measure calculates]
measure [MeasureName] = ...
  • Replacing the TMDL code of your measures with the output from
    your AI tool.
  • Reviewing all the descriptions — as you can see below, all the
    generated descriptions appear to be correct.
  • Clicking Apply to push the descriptions.

Now, you have descriptions of all measures in your semantic model. This can be seen in the example below.

5. Git version control

TMDL is also a file format. The simplest and fastest way to implement version control for your semantic model is to copy it into a text editor or an IDE like VS Code and save it with the .tmdl extension (see the image below). In the background, you can see the semantic model in VS Code. You can now push this file to your version control system of choice. This is especially useful if a single semantic model is used for multiple reports.

Power BI is also integrated with Azure DevOps for version control. If you want to set up structured version control for your Power BI models and reports, this approach is better than the simple method described above. I will cover Power BI version control using Azure DevOps integration in a future blog post.

Questions?

Feel free to contact me!

Bas Crommentuijn
Bas Crommentuijn

My name is Bas, and my interest lies at the intersection of data analysis and data engineering. My blogs mainly focus on scalable data and BI solutions.

Articles: 4