Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
User | Count |
---|---|
77 | |
76 | |
44 | |
31 | |
26 |
User | Count |
---|---|
97 | |
89 | |
52 | |
48 | |
46 |