Forum Discussion

M_SBS_6's avatar
M_SBS_6
Helper V
3 years ago
Solved

Remove first 2 characters

Hi, 

I have a column that every value starts with a 4/

The length of each can vary e.g

4/TTP000

4/123

 

I therefore just need to remove the 4/. Any idea how to do this please? 

 

Many thanks 

  • Hi M_SBS_6 ,

    You can try creating a new column in Power Query editor with the below formula -
    = Table.AddColumn(#"Added Conditional Column", "New Column", each Text.AfterDelimiter([Original Column], "/"), type text)

    In DAX -

    New Column = right([Original column], len([Original column]) - search("/",[Original column],,0))
     
    Hope this helps!
     
    Please accept the solution if this answers your query.
     
    Thanks!
    Avantika Thakur

3 Replies

  • Hi M_SBS_6 ,

    You can try creating a new column in Power Query editor with the below formula -
    = Table.AddColumn(#"Added Conditional Column", "New Column", each Text.AfterDelimiter([Original Column], "/"), type text)

    In DAX -

    New Column = right([Original column], len([Original column]) - search("/",[Original column],,0))
     
    Hope this helps!
     
    Please accept the solution if this answers your query.
     
    Thanks!
    Avantika Thakur
  • Hi,

    in dax you can create a calculated column this way

    Column = var  ColumnLength = LEN('Table'[Column1])-2
    var result = RIGHT('Table'[Column1], ColumnLength)
    return
    result
     and you obtain

    If this post is useful to help you to solve your issue consider giving the post a thumbs up 

     and accepting it as a solution !