OpenBI Docs Buy

MID

A number of characters from a text, from a position.

Group: Text. Compatible with DAX.

Syntax

MID ( <text>, <start_num>, <num_chars> )
ParameterTypeDescription
textTextThe text to take characters from; a number becomes text first.
start_numWhole numberWhere to begin: 1 is the text's first character.
num_charsWhole numberHow many characters to take.

Returns

Text. The characters from that position on, as many as asked for or as there are.

Remarks

  • A start past the end gives empty text; more characters than are left gives the rest of the text.
  • A start below 1, or a negative number of characters, is an error.
  • A blank text gives BLANK.
  • With FIND or SEARCH for the start, it takes the part of a text between two markers.

Examples

Characters from a position

EVALUATE
ROW (
    "Nine from the 1st", MID ( "Trondheim plant", 1, 9 ),
    "Past the end", MID ( "abc", 5, 2 ),
    "More than are left", MID ( "abc", 2, 99 )
)
Nine from the 1stPast the endMore than are left
Trondheim(empty text)bc

The middle of a code

EVALUATE
ROW ( "Postcode", MID ( "NO-0150-OSL", 4, 4 ) )
Postcode
0150

LEFT, RIGHT, FIND, SEARCH, LEN.

Last updated · OpenBI Studio 0.3.74