Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Split text string

Hi,

 

I need to split my data in the format below. Remove data after dash but since the data format is different in all rows, search function isn't working. Can someone help please. 

 

Thanks.

 

BeforeAfter
A00034A00034
012302-00112302
012302-00212302
102538-001102538
102538-002102538
0928abc-010928abc
0928abc-020928abc
1856XYZ541856XYZ54
  • If you want to keep your original Coloumn you can also use this Dax formula.

    After = IFERROR(
        MID(Table1[Before];1;SEARCH("-";Table1[Before])-1);
        Table1[Before])

     

     

     

    have a great weekend. :-)

4 Replies

  • Thim's avatar
    Thim
    Resolver V

    Go into Quiry Editor

    Right click on the column and choose "split column" and "by delimiter"

     

    Choose Custom, and put the sign -

    This will put all data past the - in a new colunm, and entirely remove the -

    then you can just remove the "new" column.

     

     

    Hope the will help. :-)

     

     

    • Thim's avatar
      Thim
      Resolver V

      If you want to keep your original Coloumn you can also use this Dax formula.

      After = IFERROR(
          MID(Table1[Before];1;SEARCH("-";Table1[Before])-1);
          Table1[Before])

       

       

       

      have a great weekend. :-)

      • Anonymous's avatar
        Anonymous
        Not applicable

         

        Thim

         

        Wow! That worked. 

         

        Thanks for the help! :-)