DAX function
LEFT / RIGHT — DAX function reference
Characters from one end.
Syntax
dax
LEFT(<text>, <num_chars>) RIGHT(<text>, <num_chars>)
Examples
dax
LEFT([Code], 3)
→ A substring
dax
RIGHT([Code], 4)
→ The last 4 characters, e.g. a check digit or suffix
dax
IF(LEFT(Customer[Phone], 1) = "1", MID(Customer[Phone], 2, 10), Customer[Phone])
→ Strips a leading country code before formatting a phone number
Common mistakes & gotchas
- Both are character-based, not word-based — LEFT([Name], 5) truncates mid-word if the boundary falls inside a word; DAX has no built-in word-wise truncation.
- If num_chars exceeds the string’s length, LEFT/RIGHT simply return the whole string rather than erroring or padding — no need to guard with LEN() first.
Related DAX functions
From Text