Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
In my report I have a field e.g. HC_field.
Based on this field I have created a measure HC_measure.
HC_measure is used in several visuals, and other calculations/measures in the report.
Later during my development, I have realised that a new field HC_field2 is more accurate for the HC_measure calculation.
How do I replace HC_field with HC_field2 in a way so all the references (i.e. measures and visuals) to HC_field will now refer to HC_field2 ?
In case I decide to create a new measure HC_measure2, and want all my visuals to use HC_measure2 instead of HC_measure - how do I do that ?
Many thanks
Solved! Go to Solution.
You can replace the column name in all measures by using the following script in Tabular Editor (Advanced Scripting tab):
var FromString = "HC_field";
var ToString = "HC_field2";
foreach (var m in Model.AllMeasures)
{
m.Expression = m.Expression.Replace(FromString,ToString);
}
https://exceleratorbi.com.au/edit-replace-code-inside-all-dax-measures-using-tabular-editor/
I'm not aware of a way to programmatically swap fields in visuals.
Proud to be a Super User!
You can replace the column name in all measures by using the following script in Tabular Editor (Advanced Scripting tab):
var FromString = "HC_field";
var ToString = "HC_field2";
foreach (var m in Model.AllMeasures)
{
m.Expression = m.Expression.Replace(FromString,ToString);
}
https://exceleratorbi.com.au/edit-replace-code-inside-all-dax-measures-using-tabular-editor/
I'm not aware of a way to programmatically swap fields in visuals.
Proud to be a Super User!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!