Microsoft Power BI DAX provides various String Functions such as LEN, LEFT, RIGHT, LOWER, UPPER, MID, SUBSTITUTE, FORMAT, CONCATENATE, CONCATENATEX, REPT, UNICHAR, VALUES, etc. In this article, we will show you, How to use Power BI DAX String Functions with examples.

To demonstrate these Power BI DAX String functions, we are going to use the below-shown data. As you can see, there are 15 records in this table.

## Power BI DAX String Functions

The following series of examples will show you the list of DAX String Functions in Power BI

### Power BI DAX LEN Function

The DAX Now function returns the length of a given string. The syntax of this Power BI DAX LEN is as shown below:

LEN(string)

To demonstrate these DAX String functions in Power BI, we have to use the calculated column. In order to create a column, please click on the **New Column** option under the **Home** tab, or **Modeling **tab.

As you can see from the below screenshot, we renamed the default column name as LEN. Below statement will find the length of a character string in Department name column

LEN = LEN(EmployeeSales[Department Name])

Let me add this LEN column to the table that we created earlier. Please refer Create Table Report article to understand the steps involved in creating a table

### Power BI DAX LEFT Function

The DAX LEFT function is used to return the leftmost characters from a string up to specified index position. The syntax of this Power BI DAX LEFT Function is as shown below:

LEFT(string, position)

Below statement will return leftmost 8 characters from the Department name column

LEFT = LEFT(EmployeeSales[Department Name], 8)

### Power BI DAX RIGHT Function

The DAX RIGHT function is used to return rightmost characters from a string up to specified index position. The syntax of Power BI DAX RIGHT Function is as shown below:

RIGHT(string, position)

It returns rightmost 6 characters from the Department name column

RIGHT = RIGHT(EmployeeSales[Department Name], 6)

### Power BI DAX LOWER Function

The DAX LOWER function converts the given string of characters to lower case. The syntax of Power BI DAX LOWER Function is as shown below:

LOWER(string)

It converts the Department name column into lowercase

LOWER = LOWER(EmployeeSales[Department Name])

### Power BI DAX UPPER Function

The DAX UPPER function converts the given string into uppercase. The syntax of Power BI DAX UPPER Function is as shown below:

UPPER(string)

Below statement convert Department name column string into uppercase

UPPER = UPPER(EmployeeSales[Department Name])

### Power BI DAX MID Function

The DAX MID function returns a substring from the original string. The syntax of Power BI DAX MID Function is as shown below:

MID(string, starting_position, length)

This function accepts three arguments:

- Starting position – Substring start from this position
- Length – Total length of a substring.

It returns a substring from the Department Name column. Sub-string starts at position no 4 and ends when string length reaches to 7.

MID = MID(EmployeeSales[Department Name], 4, 7)

### Power BI DAX REPT Function

The DAX REPT function is used to repeat a string for the user-specified number of time. The syntax of this Power BI DAX REPT Function is:

REPT(string, no_of_times)

It repeats the data in LastName column for 2 times

REPT = REPT(EmployeeSales[LastName], 2)

### Power BI DAX SUBSTITUTE Function

The DAX SUBSTITUTE function is used to repeat a string for the user-specified number of time. The syntax of this Power BI DAX SUBSTITUTE Function is:

SUBSTITUTE(string, old_string, new_string)

It replaces the Software word with Web inside the Department Name column values

SUBSTITUTE = SUBSTITUTE(EmployeeSales[Department Name], "Software", "Web")

### Power BI DAX UNICHAR Function

The DAX UNICHAR function returns the Unicode character for the given ASCII value. The syntax of this Power BI DAX UNICHAR Function is:

UNICHAR(number)

It will return the Unicode characters of Yearly income divide by 2

UNICHAR = UNICHAR(EmployeeSales[Yearly Income] / 2)

### Power BI DAX EXACT Function

The DAX EXACT function in Power BI compares two strings, and return true if they are exactly equal otherwise, it returns false. The syntax of this Power BI DAX EXACT Function is:

EXACT(string1, string2)

Below statement will compare Department Name with Leftmost 18 characters of Department Name

EXACT = EXACT(EmployeeSales[Department Name], LEFT(EmployeeSales[Department Name], 18))

### Power BI DAX CONCATENATE Function

The Power BI DAX CONCATENATE function is used to concatenate two strings. The syntax of this Power BI DAX CONCATENATE Function is:

CONCATENATE(string1, string2)

Below statement concatenate first name and last name

CONCAT = CONCATENATE(EmployeeSales[FirstName], EmployeeSales[LastName])

### Power BI DAX CONCATENATEX Function

The DAX CONCATENATEX function is used to concatenate all the rows in a column using the specified delimiter. The syntax of this Power BI DAX CONCATENATEX Function is:

CONCATENATEX(tableName, ColumnName, Delimiter)

Below statement concatenate all the rows in last name column using a comma delimiter

CONCATENATEX = CONCATENATEX(EmployeeSales, EmployeeSales[LastName], ",")

### Power BI DAX FIXED Function

The DAX FIXED function in Power BI is used to round the given number t specified number of digits and returns in text data type. The syntax of this Power BI DAX FIXED Function is:

FIXED(number, decimals, comma)

Below statement rounds sales decimals to a single digit, and it will not allow comma

FIXED = FIXED(EmployeeSales[Sales], 1, 1)

### Power BI DAX BLANK Function

The Power BI DAX BLANK function is used to return blank. You can also use this to check whether the crows have any blanks or not. The syntax of this Power BI DAX BLANK Function is:

BLANK()

Below If statement checks whether there are any blanks while dividing Sales by Service Grade. If true then Blank will be replaced by 100 otherwise, it returns the result.

BLACNK = IF(DIVIDE(EmployeeSales[Sales], EmployeeSales[Service Grade]) = BLANK(), 100, DIVIDE(EmployeeSales[Sales], EmployeeSales[Service Grade]))

From the below screenshot, you can see the result.

### Power BI DAX UNICODE Function

The DAX UNICODE function in Power BI returns the ASCII value of the first character in a string. The syntax of this Power BI DAX UNICODE Function is:

UNICODE(string)

Below statement returns the ASCII value of the first character in the last name column

CODE = UNICODE(EmployeeSales[LastName])

### Power BI DAX COMBINEVALUES Function

The Power BI DAX COMBINEVALUES function is used to combine two or more strings using the specified delimiter. The syntax of this Power BI DAX COMBINEVALUES Function is:

COMBINEVALUES(Delimiter, string1, string2,..)

Below statement combine First Name, Last Name, Education columns using a comma delimiter

CONCATENATEX = CONCATENATEX(EmployeeSales, EmployeeSales[LastName], ",")

### Power BI DAX FORMAT Function

The DAX FORMAT function in Power BI format numbers, and dates to predefined formats. The syntax of a Power BI DAX FORMAT Function is:

FORMAT(expression, format_type)

Below statement formats the Sales amount into currency type

FORMAT = FORMAT(EmployeeSales[Sales], "Currency")

### Power BI DAX VALUE Function

The Power BI DAX VALUE function converts the string numbers into a number. The syntax of Power BI DAX VALUE Function is:

VALUE(string)

Below statement converts the string numbers in Fixed function result to a number

VALUE = VALUE(EmployeeSales[FIXED])