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.
Hello,
In Power Query how can I replace a value with a new value containing a superscript. I need to replace oldName with
newName+ where the + is a superscript.
Thanks,
Solved! Go to Solution.
Before:
After
With the formula:
= Table.ReplaceValue(#"Changed Type","+", Character.FromNumber(0x207A),Replacer.ReplaceText,{"Value"})
Did I answer your question? Then please mark my post as the solution and make it easier to find for others having a similar problem.
If I helped you, please click on the Thumbs Up to give Kudos.
Kees Stolker
A big fan of Power Query and Excel
HI @Anonymous, what about this?
enter TextToReplace
Output
let
Source = #table(type table[Value=text], {{"Anything"}, {"Something else"}, {"Another text abc"}}),
TextToReplace = {"Anything", "text"},
R = [ a = List.Transform(TextToReplace, Text.Trim),
b = Record.FromList(List.Transform(a, each _ & "⁺"), a)
][b],
StepBack = Source,
Ad_Replaced = Table.AddColumn(StepBack, "Replaced", each Text.Combine(List.Transform(Text.Split([Value], " "), (x)=> Record.FieldOrDefault(R, x, x)), " "), type text)
in
Ad_Replaced
Before:
After
With the formula:
= Table.ReplaceValue(#"Changed Type","+", Character.FromNumber(0x207A),Replacer.ReplaceText,{"Value"})
Did I answer your question? Then please mark my post as the solution and make it easier to find for others having a similar problem.
If I helped you, please click on the Thumbs Up to give Kudos.
Kees Stolker
A big fan of Power Query and Excel
Thanks. Your solution does work. Staying with your example, assume the starting value is "Anything" rather then "Anything+". How would you replace "Anything" with "Anything+" (+ is a superscript)?
Table.ReplaceValue(#"Changed Type","Anything+", "Anything" & Character.FromNumber(0x207A),Replacer.ReplaceText,{"Value"})
Pls try
let
Source = "Anything",
tab= #table(1, {{Source}}),
AddCol = Table.AddColumn(tab, "to", each [Column1]&"⁺")
in
AddCol