Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi!
Is it possible in some way to use Text.Remove with several characters?
This formula works when I add a new column, using one character in the text.remove:
if Text.Contains([Equipment ID],"-1") then
Text.Remove([Equipment ID],"-") else
[Equipment ID]
This is how I would like it to work, I want to remove the text "-1".
if Text.Contains([Equipment ID],"-1") then
Text.Remove([Equipment ID],"-1") else
[Equipment ID]
Thanks in advance.
Best regards, Pauline
Solved! Go to Solution.
You could try Text.Replace and use "" as the new text.
Hi @P-Lag
You can nest multiple Text.Replace functions in one custom step. Text.Replace - PowerQuery M | Microsoft Learn
= Table.TransformColumns(#"previous step name", {{"Equipment ID", each Text.Replace(Text.Replace(_, "-1", ""), "S", "")}})
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
try this
Text.Combine(Splitter.SplitTextByAnyDelimiters({"-1","S"})([EmployeeID]))
Use this (No need to check for Text.Contains)
= Text.Remove([Equipment ID],Text.ToList("-1"))
Hi
@Vijay_A_Verma
Thanks for the tip to remove text.contains. Unfortunately this formula did not work, it removed all 1 and -1, so it removed more values than wanted.
try this
Text.Combine(Splitter.SplitTextByAnyDelimiters({"-1","S"})([EmployeeID]))
You could try Text.Replace and use "" as the new text.
Hi @johnt75
Thanks for the help, this worked! Just one more question. Is it possible to combine it with multiple argument? I would like to remove another value in the same expression but I don't success.
for example
replace "-1" and "S" with ""
I have trided to add "and" function but do not sucess.
Hi @P-Lag
You can nest multiple Text.Replace functions in one custom step. Text.Replace - PowerQuery M | Microsoft Learn
= Table.TransformColumns(#"previous step name", {{"Equipment ID", each Text.Replace(Text.Replace(_, "-1", ""), "S", "")}})
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
I think you would need to add separate steps, one for each value you want to replace.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |