Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

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

 

 

  • abhi9255's avatar
    abhi9255
    8 years ago

    for example remove "-" from the string

     

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

5 Replies

  • Create a new column and insert the dax as follows

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Abi,

       

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

       

      Thanks

       

      C

      • abhi9255's avatar
        abhi9255
        Icon for Advocate II rankAdvocate II

        for example remove "-" from the string

         

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