The Power BI LEFT function is one of the DAX text functions useful to return the given number of leftmost characters from the start of the string. This article explains the DAX LEFT function that accepts the original text and the number of characters (integer value) and the syntax is shown below:
LEFT(<text>, <num_chars>)
text: The original string text pointed to a column that acts as the reference point to extract the characters.
num_chars: It is an optional argument and the default value is 1. If you specify any number, the DAX LEFT function returns the mentioned leftmost characters from <text>. The best part is if the value is greater than the string length, it returns the whole string instead of an error.
Power BI DAX LEFT function Example
To demonstrate the DAX LEFT() function, we use the FullName column from the simple Employee table with 15 records. To demonstrate the LEFT, we need a new column. So, go to the Modeling Tab, click the New Column button, and rename it LeftName.
The below expression returns the first six characters or letters from the FullName column. Next, please add the LeftName 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.
LeftName = LEFT(EmployeeEmails[FullName], 6)
The below Power BI DAX expression uses the FIND and LEFT functions to return the string before the @ symbol in the Email address column. The FIND method finds the index position of the @ symbol. Next, the LEFT function returns the leftmost charters to that position.
LeftEmail = LEFT(EmployeeEmails[Email Adress], FIND("@", EmployeeEmails[Email Adress]) - 1)