Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 months ago
Solved

Remove string and parenthesis

Hi,

 I have a column with a number of different stores each ending with the area (these are different) in parenthesis.

 What I would like is to remove the parenthesis and the string within that.

 eg. Store 1 (Cardiff) = Store 1
       Store 2 (Birmingham) = Store 2

etc

Any ideas how to do this?
Thanks

Alex

     

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank-you, I sent the request and then realised what I needed to do but thank-you for posting a reply.

  • Hi Anonymous, there are two options to achieve this, depending on whether you want to cleanse it as a column in Power Query or extract it via DAX.

    Power Query Editor:

    • Transform > Extract > Text Before Delimiter
    • Set the delimiter to " (" => this will keep the first part of your text until it encounters a space + parenthesis (works if the text you want to keep is always before the parenthesis:

    DAX (Note: I renamed the table + column in this example, to make it easier to understand the formula):

    Cleaned DAX = LEFT(ExampleTable[RawColumn], SEARCH(" (", ExampleTable[RawColumn])-1)