Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Community
I´ve found this script to change in bulk measures using Tabular Editor:
var FromString = "Text1";
var ToString = "Text2";
foreach(var c in Selected.Measures)
{
c.Expression = c.Expression.Replace(FromString,ToString);
/* Cycle over all measures in model and replaces the
FromString with the ToString */
}
It works pretty good for measures but dont seem to work for Calculated Columns because I get the following error.
Does anyone know how to solve this issue???
Thanks in advance
Best
Solved! Go to Solution.
Hey @dbernabefdez
After looking at the documentation and doing an example you should try the following code
var FromString = "Text1";
var ToString = "Text2";
foreach(var c in Selected.CalculatedColumns)
{
c.Expression = c.Expression.Replace(FromString,ToString);
/* Cycle over all measures in model and replaces the
FromString with the ToString */
}
Hope it works for you.
Cheers, LQ
Hey @dbernabefdez
After looking at the documentation and doing an example you should try the following code
var FromString = "Text1";
var ToString = "Text2";
foreach(var c in Selected.CalculatedColumns)
{
c.Expression = c.Expression.Replace(FromString,ToString);
/* Cycle over all measures in model and replaces the
FromString with the ToString */
}
Hope it works for you.
Cheers, LQ
WOUU incredible!!!! Works great
I was making the mistake of using ""foreach(var c in Selected.Columns)"" instead of ""foreach(var c in Selected.CalculatedColumns)""
Thank you so much for your help
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.