DAX function
TRIM — DAX function reference
Remove extra spaces.
Syntax
dax
TRIM(<text>)
Examples
dax
TRIM([Name])
→ Trimmed text
dax
FILTER(Customer, TRIM(Customer[Name]) <> Customer[Name])
→ Finds rows where the source data has leading/trailing or doubled internal whitespace
dax
LOOKUPVALUE(Rate[USD], Rate[CurrencyCode], TRIM(UPPER(Sales[CurrencyCode])))
→ Normalizes a lookup key before matching, guarding against messy source data
Common mistakes & gotchas
- DAX's TRIM removes leading/trailing spaces and also collapses multiple internal spaces down to one — this differs from languages whose trim only strips the ends and leaves internal whitespace untouched.
- It only strips the regular space character; other whitespace-like characters (tabs, non-breaking spaces from copy-pasted source data) pass through unaffected, a common reason "trimmed" text still fails to match in a comparison.
Related DAX functions
From Text