Forum Discussion
cristianml
4 years agoPost Prodigy
Multiple strings table.replacevalue
Hi, I need help to use in M (query editor) the replacevalue function for multiple strings. This is what I have so far: Table.ReplaceValue(Source,each [COLUMN1], each if( {"String1","StringRepla...
- Anonymous4 years ago
Hi cristianml ,
Please have a try.
Table.ReplaceValue(#"Changed Type", each [COLUMN], each if Text.Contains([COLUMN], "String1") then Text.Replace([Custom], "String1", "StringReplaced1") else if Text.Contains([COLUMN], "String2") then Text.Replace([Custom], "String2", "StringReplaced2") else if Text.Contains([COLUMN], "String3") then Text.Replace([Custom], "String3", "StringReplaced3") else if Text.Contains([COLUMN], "String4") then Text.Replace([Custom], "String4", "StringReplaced4") else if Text.Contains([COLUMN], "String5") then Text.Replace([Custom], "String5", "StringReplaced5") else if Text.Contains([COLUMN], "String6") then Text.Replace([Custom], "String6", "StringReplaced6") else if Text.Contains([COLUMN], "String7") then Text.Replace([Custom], "String7", "StringReplaced7") else if Text.Contains([COLUMN], "String8") then Text.Replace([Custom], "String8", "StringReplaced8") else if Text.Contains([COLUMN], "String9") then Text.Replace([Custom], "String9", "StringReplaced9") else if Text.Contains([COLUMN], "String10") then Text.Replace([Custom], "String10", "StringReplaced10") else if Text.Contains([COLUMN1], "String11") then Text.Replace([Custom], "String11", "StringReplaced11") else if Text.Contains([COLUMN], "String12") then Text.Replace([Custom], "String12", "StringReplaced12") else if Text.Contains([COLUMN], "String13") then Text.Replace([Custom], "String13", "StringReplaced13") else if Text.Contains([COLUMN], "String14") then Text.Replace([Custom], "String14", "StringReplaced14") else "NA", Replacer.ReplaceText,{"COLUMN"})If I have misunderstood your meaning, please provide more details with your desired output and your pbix file without privacy information.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Hi cristianml ,
Please have a try.
Table.ReplaceValue(#"Changed Type", each [COLUMN],
each if Text.Contains([COLUMN], "String1") then Text.Replace([Custom], "String1", "StringReplaced1")
else if Text.Contains([COLUMN], "String2") then Text.Replace([Custom], "String2", "StringReplaced2")
else if Text.Contains([COLUMN], "String3") then Text.Replace([Custom], "String3", "StringReplaced3")
else if Text.Contains([COLUMN], "String4") then Text.Replace([Custom], "String4", "StringReplaced4")
else if Text.Contains([COLUMN], "String5") then Text.Replace([Custom], "String5", "StringReplaced5")
else if Text.Contains([COLUMN], "String6") then Text.Replace([Custom], "String6", "StringReplaced6")
else if Text.Contains([COLUMN], "String7") then Text.Replace([Custom], "String7", "StringReplaced7")
else if Text.Contains([COLUMN], "String8") then Text.Replace([Custom], "String8", "StringReplaced8")
else if Text.Contains([COLUMN], "String9") then Text.Replace([Custom], "String9", "StringReplaced9")
else if Text.Contains([COLUMN], "String10") then Text.Replace([Custom], "String10", "StringReplaced10")
else if Text.Contains([COLUMN1], "String11") then Text.Replace([Custom], "String11", "StringReplaced11")
else if Text.Contains([COLUMN], "String12") then Text.Replace([Custom], "String12", "StringReplaced12")
else if Text.Contains([COLUMN], "String13") then Text.Replace([Custom], "String13", "StringReplaced13")
else if Text.Contains([COLUMN], "String14") then Text.Replace([Custom], "String14", "StringReplaced14")
else "NA", Replacer.ReplaceText,{"COLUMN"})
If I have misunderstood your meaning, please provide more details with your desired output and your pbix file without privacy information.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.