Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'm trying to replace values in a single text column that begin with a specifc character. Something like
Table.ReplaceValue(#"Merged Columns","3%",null,Replacer.ReplaceValue,{"Column2"}), but I can't figure out the correct syntax.
Thanks in advance for any help.
Bryce
Solved! Go to Solution.
Hi @brycedwhite ,
According to your description, I create a sample.
In my understanding, if the cell begin with 3% then replace the cell to null. Here's my solution:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YlWMlZ1AtPOYNLFWBUqqhQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column2", type text}}),
#"New" = Table.ReplaceValue(#"Changed Type",each [Column2], each if Text.StartsWith(Text.From([Column2]),"3%") then null else [Column2],Replacer.ReplaceValue,{"Column2"})
in
#"New"
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @brycedwhite ,
According to your description, I create a sample.
In my understanding, if the cell begin with 3% then replace the cell to null. Here's my solution:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YlWMlZ1AtPOYNLFWBUqqhQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column2", type text}}),
#"New" = Table.ReplaceValue(#"Changed Type",each [Column2], each if Text.StartsWith(Text.From([Column2]),"3%") then null else [Column2],Replacer.ReplaceValue,{"Column2"})
in
#"New"
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Might be easier to use the Table.TransformColumns function:
= Table.TransformColumns(#"Merged Columns",{"Column2", each if Text.StartsWith(_,"3%")
then null else _})
OR
#"Starts with" = Table.TransformColumns(#"Merged Columns",{"Column2", each if Text.StartsWith(_,"3%")
then Text.ReplaceRange(_,0,2,"") else _})
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
6 | |
6 | |
6 |