Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
thod
Helper I
Helper I

Reuse tmdl scripts

Hi,
I have created a TMDL script snippet (a formattet calendar table, eg. created spaces in column names) that I want to reuse in other models.
When I create a new model, implement the script and click apply in TMDL view, the formattet table shows up. However, when I refresh the model within Power BI desktop, the table reformats to the source column names. I then need to go back to TMDL view and click apply again.
Am I doing something wrong so it can be avoided?
My test script is:


createOrReplace

    table Dato
        lineageTag: 5f8716ac-005a-405d-8f55-d40786b53a72
        dataCategory: Time

        column 'Dato Tid Fra'
            dataType: dateTime
            formatString: General Number
            lineageTag: ffb6bdc2-5ade-4339-b5c3-ecbfd92a113d
            dataCategory: Uncategorized
            summarizeBy: none
            sourceColumn: Dato Tid Fra

            annotation SummarizationSetBy = User

        column Dato
            dataType: dateTime
            isNullable: false
            formatString: Short Date
            lineageTag: 05acc131-b6b3-498f-b998-010145dfcb45
            dataCategory: Uncategorized
            summarizeBy: none
            sourceColumn: Dato

            annotation SummarizationSetBy = User

        column DW_SK_Dato
            dataType: int64
            isHidden
            isNullable: false
            lineageTag: 7cb8437a-3dda-4290-88cd-443305dc0b03
            dataCategory: Uncategorized
            summarizeBy: none
            sourceColumn: DW_SK_Dato

            annotation SummarizationSetBy = User

        partition Dato = m
            mode: directQuery
            source =
                    let
                        Source = Sql.Database(Server, Database, [Query="/****** Script for SelectTopNRows command from SSMS  ******/#(lf)SELECT [DW_SK_Dato]#(lf)      ,[Dato]#(lf)      ,[DatoTidFra]#(lf)  FROM [DSO_SharedDimensions].[all].[DimDato]"])
                    in
                        Source

        annotation PBI_NavigationStepName = Navigation

        annotation PBI_ResultType = Table
1 ACCEPTED SOLUTION
v-pbandela-msft
Community Support
Community Support

Hi @thod,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept  as  Solution" and give a 'Kudos' so other members can easily find it.

Thank you,
Pavan.

View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @thod ,

 

This functionality was just released in the new Power BI desktop version of May. So you can now if you rename the columns the values persist without the need to have a step on Power Query.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



v-pbandela-msft
Community Support
Community Support

Hi @thod,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept  as  Solution" and give a 'Kudos' so other members can easily find it.

Thank you,
Pavan.

v-pbandela-msft
Community Support
Community Support

Hi @thod,

Thank you for reaching out in Microsoft Community Forum.

Thank you  @MFelixfor the helpful responses.

As suggested by MFelix,  I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as Solution" and give it a 'Kudos' so others can find it easily.

Please continue using Microsoft community forum.

Regards,
Pavan.

MFelix
Super User
Super User

Hi @thod ,

 

This feature is still on preview, I believe that what is happening is that since you are applying the TMDL on top of the table you have on your model, it does not create the additional step of the rename in M language causing it to not recognize at the first run.

 

I would send this to the feedback form

 

https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR63OJ8qKvQlMm9JxH0flWGRUM0E4...

 

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-tmdl-view-for-power-bi-desktop-preview/


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



johnt75
Super User
Super User

This could be a bug, especially as its still a preview feature. I'd use the "Submit feedback" button in TMDL view to let MS know.

As a workaround you could do your column renaming either in SQL or in Power Query. That should get picked up and remembered when you do a refresh.

Yes, I already gave the feedback. Just wanted to know if anyone here had experienced the same thing and found a solution 🙂

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.