Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Remove trailing 2 characters from end string

Hello,   I am rather new to the M langauge and need some help.    I have a column with strings that are either BFD###### or BF###### . I am looking to remove the last 2 characters from this strin...
  • v-danhe-msft's avatar
    v-danhe-msft
    7 years ago

    Hi Anonymous ,

    Based on my test, you could refer to below steps:

    In power query:

    Add a custom column and enter below code:

    Text.Start([Data],Text.Length([Data])-2)

    Result:

    In dax, you could refer to below formula:

    Column = LEFT('Table1 (2)'[Data],LEN('Table1 (2)'[Data])-2)

    Result:

    You could also download the pbix file to have a view.

     

    Regards,

    Daniel He