Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Edit/Replace in a DAX measure

Hello,

 

I've made some changes to my excel data for the sake of uniformity, but now I need to go and adjust my DAX measures to reflect those changes.

Is there a function in Power BI similar to the "Replace" function in excel (picture)  so I don't have to manually change every single occurance of this data in my measures?

 

Thanks in advance for your help!

 

 

  • Anonymous,

     

    You can achieve this with Tabular Editor (free utility). In the Advanced Scripting tab of Tabular Editor, run the following:

     

    var FromString = "Group 6 MS 404";
    var ToString = "Group 6 (MS 404)";
    
    foreach (var m in Model.AllMeasures)
    {
    m.Expression = m.Expression.Replace(FromString,ToString);
    }

     

4 Replies

  • Anonymous,

     

    You can achieve this with Tabular Editor (free utility). In the Advanced Scripting tab of Tabular Editor, run the following:

     

    var FromString = "Group 6 MS 404";
    var ToString = "Group 6 (MS 404)";
    
    foreach (var m in Model.AllMeasures)
    {
    m.Expression = m.Expression.Replace(FromString,ToString);
    }