TRIM Function (DAX)

How does the TRIM function (DAX) work?

The TRIM function (DAX) removes all spaces from text except for single spaces between words.

TRIM Formula Syntax

TRIM (
     <text>
)

How do you use the TRIM function?

Use TRIM on text that you have received from another application that may have irregular spacing.

The TRIM function does not remove the nonbreaking space character. For an example of how to trim both space characters from text, see Remove spaces and nonprinting characters from text.

Related Blog Posts

 

Considerations when using the TRIM function

If you need to remove trailing non-breaking spaces, create a computed field using the following expression. The REPLACE( ) function replaces any non-breaking spaces with regular spaces, and then TRIM( ) removes any trailing regular spaces. TRIM( ) is related to the LTRIM( ) function, which removes any leading spaces from a string, and to the ALLTRIM( ) function, which removes both leading and trailing spaces.

Related Video Tutorials

Formula examples using the TRIM function

=TRIM(“A column with trailing spaces. “)

=TRIM(” First Quarter Earnings “)

=TRIM(A1)

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI