Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
P-Lag
Helper I
Helper I

Text.Remove with several characters

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

3 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

You could try Text.Replace and use "" as the new text.

View solution in original post

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", "")}})

vjingzhang_0-1681355785546.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

try this

Text.Combine(Splitter.SplitTextByAnyDelimiters({"-1","S"})([EmployeeID]))

View solution in original post

7 REPLIES 7
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

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]))

johnt75
Super User
Super User

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", "")}})

vjingzhang_0-1681355785546.png

 

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.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.