It is great to see the advancements in Power BI with regards to TMDL.

Recently I was working on a customer’s semantic model where I was doing some optimizations in the semantic model.

One of the changes I wanted to make was to replace the Dynamic Format String for the measures.

My challenge was that there were roughly 40 measures where the Dynamic Format String needed to be updated.

I could have done this using Power BI Desktop, but that would mean making the changes 40 times.

A screenshot of a computer

AI-generated content may be incorrect.

Each time the change is made I would have to make the changes, then wait for it to complete before going into the next measure.

What I did to make this change was to use the new TMDL view to make the change, which I will explain below.

Using TMDL View

Because I had all my measures on a single table, what I could then do was to go into the TMDL view and drag in my table.

I clicked on TMDL View.

I could then see my table in the TMDL View

A screenshot of a computer

AI-generated content may be incorrect.

This is now where the beauty of TMDL makes it easy.

What I did was search for an existing measure, searching for the “formatStringDefinition”

I then used the Find and Replace option.

NOTE: The keyboard shortcut to do this is CTRL + H

As shown below I had previously copied the text I wanted to find.

And then I in the replace section I had put in the text I wanted to replace as shown below.

I could see the highlighted text that is going to be changed as shown below.

A screenshot of a computer program

AI-generated content may be incorrect.

I then clicked on the button to replace All

Once everything had been replaced, I could validate the changes are as expected before applying the change.

As shown below I could see the changes were made and looks good.

A screenshot of a computer screen

AI-generated content may be incorrect.

A computer screen shot of a program

AI-generated content may be incorrect.

I then clicked on Apply as shown below.

A green and white sign with black text

AI-generated content may be incorrect.

I then went back to my Report view, where I validated that the Dynamic Format String as been applied.

Summary

In this blog post I have demonstrated how using TMDL view helped me to bulk replace 40 Dynamic Format Strings with a simple find and replace.

This certainly saved me hours of time, as well as not creating any errors by copying and pasting so many times.

Thanks for reading, any comments and suggestions are most welcome.