Search code examples
powerbidaxpowerquerym

Delete leading and trailing spaces in DAX Power Query


I am looking for SQL equivalent of ltrim(rtrim(text))

Is it the same as DAX: TRIM function or M function: Text.Trim ?


Solution

  • For Dax use the following measures (works in columns the same):

    Measure 0:=" A column with spaces. "
    Measure 1:=TRIM([Measure 0])
    

    Check lengths of both fields:

    Len 0:=len([measure 0])
    Len 1:=len([Measure 1])
    

    Results: Len 0: 23 Len 1: 21

    enter image description here