Forum Discussion

Pandadev's avatar
Pandadev
Post Prodigy
5 years ago
Solved

Remove text from column based on another column in same table

I have a table imported daily from the web and it contains two columns , one is name and address and the other is just address

I need to extract just the name from the address , by a formula to remove what is in the address column from the name address column

Name Address                                                                    Addresss

John Smith Johns Beach Bar , Miami , US                           Johns Beach Bar , Miami , US

Mike Brown Mikes Beach Bar , Florida , US                        Mikes Beach Bar , Florida , US

 

I need a Name Column adding which just shows the name 

John Smith

Mike Brown

 

I need to do this in query editor please

  • Anonymous's avatar
    Anonymous
    5 years ago

    HI Pandadev,

    Did you mean to remove the 'text string' stored in the 'address' column from the 'name address' field? If that is the case, you can create a calculated column with SUBSTITUTE function:

    Replaced = SUBSTITUTE([Name Address],[Addresss],"")

    Regards,

    Xiaoxin Sheng

4 Replies

    • Pandadev's avatar
      Pandadev
      Post Prodigy

      unfortunately not , sometimes it can be like

      Smith, Arnold James

      John & Mary Smith

  • Anonymous's avatar
    Anonymous
    Not applicable


    Pandadev  you can make use of below measure

    extract name = LEFT('Table'[Name Address  ],LEN('Table'[Name Address  ])-LEN('Table'[Addresss])))

    Regards
    Husna
  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Pandadev,

    Did you mean to remove the 'text string' stored in the 'address' column from the 'name address' field? If that is the case, you can create a calculated column with SUBSTITUTE function:

    Replaced = SUBSTITUTE([Name Address],[Addresss],"")

    Regards,

    Xiaoxin Sheng