Forum Discussion
Replacing characters in a string based on another column
- 4 years ago
You used the wrong syntax.
each [field name]not
each "field name"
Look at my code sample above.
How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.
You used the wrong syntax.
each [field name]
not
each "field name"
Look at my code sample above.
How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.
Thanks! I was able to get it to work.
I changed the column name from "calc-What cycle is the group in?" to "cycle" because the column name format was throwing errors when enclosed in brackets.
= Table.ReplaceValue(#"Renamed Columns1","99",each [cycle],Replacer.ReplaceText,{"What cycle is the group in?"})
- edhans4 years agoCommunity Champion
Yeah, when you have special characters in a field, you have to do it like this, which is a pain:
[#"calc-What cycle is the group in?"]