Forum Discussion

Namoh's avatar
Namoh
Post Partisan
6 years ago
Solved

Remove first 2 characters from a column value

Hi.

 

I need to combine a few things, in PQE, in one new column.

I can do this via CONCATENATE.

Part of this combination is a value in a column, but I need to remove the first 2 characters.

 

Any idea how to do this?

OldNew
201818
202121
Somethingmething

 

Once I have this formula, I can combvine it with my concatenate.

 

 

 

  • From PQE, you can perform the below for having last 2 digits of Number column:
    1. Duplicate the Number column

    2. Perform below operations from Home ->Transform section at top:

    Split Column >> By Number of Characters

     

    3. Modify with below:

    Number of Characters = 2

    Split = Once, as far right as possible

     

    4. Remove unwanted split column and rename new column

     

    Alternatively, you can use below formula in Advanced Editor:
    #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Number", "Duplicated Number"),
    #"Split Column by Position" = Table.SplitColumn(Table.TransformColumnTypes(#"Duplicated Column", {{"Duplicated Number", type text}}, "en-IN"), "Duplicated Number", Splitter.SplitTextByPositions({0, 2}, true), {"Duplicated Number", "New Number"}),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Position",{"Duplicated Number"})

     

    Don't forget to give thumbs up and accept this as a solution if it helped you !!!

18 Replies

  • Namoh 


    Add this as a new custom column in Power Query.

    Text.RemoveRange(Text.From([Old]),0,2)

     

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon on the right if you like this reply 🙂

    YouTube, LinkedIn 

    • Namoh's avatar
      Namoh
      Post Partisan

      Nope, this didn't work, probably because it's not text but a number.

    • Namoh's avatar
      Namoh
      Post Partisan

      I get the message RIGHT is not recognised

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Namoh Did my suggestion of using the MID function work for you?