Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have more than 50 calculated columns in a dataset that i need to replace some text inside the expression of each formula
For measures i have a query that i can use in the Tabular Editor that works very well and i'm looking for the same in for calculated columns
This example works for the measures selected
/* For columns */ var FromString = "oldtext"; var ToString = "newtext"; foreach (var m in Selected.Measures) { m.Expression = m.Expression.Replace(FromString,ToString); /* Cycle over all measures in model and replaces the FromString with the ToString */ }
and i'm trying to do the same with columns
/* For columns */ var FromString = "oldtext"; var ToString = "newtext"; foreach (var m in Selected.Columns) { m.Expression = m.Expression.Replace(FromString,ToString); /* Cycle over all measures in model and replaces the FromString with the ToString */ }
The "Selected.Columns" works well, the issue is in the "m.Expression = m.Expression.Replace......"
The tabular show an error that Expression can't be used, the issue here is that i need to change the expression of the formula, maybe the function "expression" is not the correct one to modify columns, i'm asking if exist another function or what can i do to modify many columns expresion in one time
Can you help me?
try
/* For columns */ var FromString = "oldtext"; var ToString = "newtext"; foreach (var m in Selected.Columns) { m.Name= m.Name.Replace(FromString,ToString); /* Cycle over all measures in model and replaces the FromString with the ToString */ }
Proud to be a Super User!
@vanessafvg not working... this try to modify the name of the column, no the expression of the column that it is what i looking for.
thanks for the help in any case
User | Count |
---|---|
117 | |
73 | |
58 | |
49 | |
48 |
User | Count |
---|---|
171 | |
122 | |
60 | |
59 | |
56 |