I was looking for a method to replace all entries in a particular column with a static statement. i found several different posts on different sites about how to do it. The simplest by far is here:
whatthefact.bi
however, i could still not get it to work with my column until i removed a hyphen in the name. My column was titled "Test - Names" and this wasn't recognised until i removed the spaces and hyphen and named it "TestNames". The example in the link above has a space in the column name so it has to be the hyphen.
Am i correct in thinking the hyphen is an issue?
with the hyphen:
= Table.ReplaceValue(#"Changed Type",each [Test - Names],"Performance Review",Replacer.ReplaceText,{"Test - Names"})
Expression.SyntaxError: Invalid identifier.
Without the hyphen, all is golden.
= Table.ReplaceValue(#"Changed Type",each [TestNames],"Performance Review",Replacer.ReplaceText,{"TestNames"})
![whatthefact.bi](/board/proxy.php?image=https%3A%2F%2Fwhatthefact.bi%2Fwordpress%2Fwp-content%2Fuploads%2F2023%2F03%2FConditional-M-change.png&hash=0eab1e6ac18e5b88ae5e002d5ea0302d&return_error=1)
One-step conditional value replacement in a column in Power Query - What the fact.bi
In Power Query you have to replace values in a column based on some conditions. This article shows how you can do that in one single step!
![whatthefact.bi](/board/proxy.php?image=https%3A%2F%2Fwhatthefact.bi%2Fandroid-icon-192x192.png&hash=6c743ecc663b9dd7242e1dc563f6948d&return_error=1)
however, i could still not get it to work with my column until i removed a hyphen in the name. My column was titled "Test - Names" and this wasn't recognised until i removed the spaces and hyphen and named it "TestNames". The example in the link above has a space in the column name so it has to be the hyphen.
Am i correct in thinking the hyphen is an issue?
with the hyphen:
= Table.ReplaceValue(#"Changed Type",each [Test - Names],"Performance Review",Replacer.ReplaceText,{"Test - Names"})
Expression.SyntaxError: Invalid identifier.
Without the hyphen, all is golden.
= Table.ReplaceValue(#"Changed Type",each [TestNames],"Performance Review",Replacer.ReplaceText,{"TestNames"})