DAX Text - LEFT function



Description

Returns the specified number of characters from the start of a text string.

Syntax

LEFT (<text>, <num_chars>) 

Parameters

Sr.No. Parameter & Description
1

text

The text string containing the characters you want to extract, or a reference to a column that contains text.

2

num_chars

Optional.

The number of characters you want LEFT to extract.

If omitted, default is 1.

Return Value

A text string.

Remarks

DAX works with Unicode and stores all characters as the same length. Therefore, a single function LEFT is enough to extract the characters.

If the num_chars argument is a number that is larger than the number of characters in the text string, DAX LEFT function returns the maximum characters available and does not raise any error.

Example

= CONCATENATE (LEFT([Product], 5), [No. of Units]) 

returns a calculated column with the first 5 characters of the Product value concatenated with the value in the No. of Units column in the same row.

dax_functions_text.htm
Advertisements