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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
klp97
Helper I
Helper I

Remove a prefix from multiple measures / Bulk renaming measures

Hello, 

 

I have a lot of measures that I would like to rename - specifically I would like to remove a prefix from all of them, let's say it's "KL - "

 

When I searched the community forums I only found this post:

 

https://community.powerbi.com/t5/Desktop/Bulk-renaming-of-measures/m-p/2641895#M927776

 

But I am not familiar enough with Tabular Editor to know what exactly to do.

 

Can someone drop some Tabular Editor code in this post that would allow me to do that? My TE version is  2.16.1.

 

Thanks in advance!

1 REPLY 1
klp97
Helper I
Helper I

Never mind, found it! Posting here for others. Unfortunately, this works, but it breaks all visuals where the renamed measures are used 😞

 

 

var FromString = "TEXT TO REPLACE";
var ToString = "REPLACEMENT TEXT";

foreach (var m in Selected.Measures)
{
    m.Name = m.Name.Replace(FromString,ToString);
}

  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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