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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to strip out characters from a string

Hi,

 

I have two seperate systems where one stores the surname with '  apostrophes etc and one which stores them without.

 

How would I go about removing the ' from a string.  I have tried using 

 

Table.AddColumn(tb_Pers_Table, "CustomSurname", each Text.Combine(List.RemoveItems(Text.ToList([Surname]),Text.ToList(",.';")))) & " " & [CH_Name_Initials]

However it throws up an error, how would I go about doing it with Dax?

 

Thanks

 

Chris

 

 

1 ACCEPTED SOLUTION

for example remove "-" from the string

 

=SUBSTITUTE([columnname], "-", "")

View solution in original post

5 REPLIES 5
abhi9255
Advocate II
Advocate II

Create a new column and insert the dax as follows

 

trimlastcharacter= LEFT(tablename[columnname],LEN(tablename[columnname])-1)

Anonymous
Not applicable

Hi Abi,

 

The apostrophe could be anywhere in ths string ie  O'Neil

 

Thanks

 

C

for example remove "-" from the string

 

=SUBSTITUTE([columnname], "-", "")

Excellent, almost cracked my head before viewing this. Thank you very much!

Thanks, @abhi9255 . This is exactly what I was looking for.

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors