Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I'm trying to replace multiple text values in one power query step. In the example below, New York and Los Angeles should be changed to Boston.
Any help appreciated.
Thanks!
Solved! Go to Solution.
In a Custom column put following
= if List.Contains({"New York","Los Angeles"},[Column A]) then "Boston" else [Column A]See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kstV4jML8pWitWJVnLKLy7JzwMzffKLFRzz0lNzUovBfI/8Uricb2ZibqZSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Column A" = _t]),
#"Added Custom" = Table.AddColumn(Source, "Column B", each if List.Contains({"New York","Los Angeles"},[Column A]) then "Boston" else [Column A])
in
#"Added Custom"
For same column, insert this step where Source should be replaced with your previous step
= Table.ReplaceValue(Source,each [Column A],each if List.Contains({"New York","Los Angeles"},[Column A]) then "Boston" else [Column A],Replacer.ReplaceValue,{"Column A"})
For same column, insert this step where Source should be replaced with your previous step
= Table.ReplaceValue(Source,each [Column A],each if List.Contains({"New York","Los Angeles"},[Column A]) then "Boston" else [Column A],Replacer.ReplaceValue,{"Column A"})
In a Custom column put following
= if List.Contains({"New York","Los Angeles"},[Column A]) then "Boston" else [Column A]See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kstV4jML8pWitWJVnLKLy7JzwMzffKLFRzz0lNzUovBfI/8Uricb2ZibqZSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Column A" = _t]),
#"Added Custom" = Table.AddColumn(Source, "Column B", each if List.Contains({"New York","Los Angeles"},[Column A]) then "Boston" else [Column A])
in
#"Added Custom"
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.