Power BI DAX TRIM function

The Power BI TRIM function is one of the DAX text functions useful to remove all the extra spaces from both the left and right sides of the string except the single spaces between words. This article explains the DAX TRIM function that accepts the text and returns the string with spaces removed and the syntax is as shown below:

TRIM(<text>)

Power BI DAX TRIM function Example

To demonstrate the DAX TRIM() function, go to the Modeling Tab, click the New Column button, and name the TrimEducation. The below expression removes all the unwanted extra spaces surrounded to the Education column in each row and returns the clean string.

Next, please add the TrimEducation column to the table report. Please refer to the String and the function article for the remaining Power BI methods. For more Charts >> Click Here.

TrimEducation = TRIM(EmployeeEmails[Education])
POWER BI DAX TRIM Function 1

To show the difference before and after TRIM, we created two extra columns to show the initial and after length.

EDULength = LEN(EmployeeEmails[Education])

TrimLen = LEN(EmployeeEmails[TrimEducation])
POWER BI DAX TRIM Function 2