MID DAX Function (Text)
Returns a string of characters from the middle of a text string, given a starting position and length.
Syntax
Parameter | Attributes | Description |
---|---|---|
Text |
The text string from which you want to extract the characters. |
|
StartPosition |
The position of the first character you want to extract. Positions start at 1. |
|
NumberOfCharacters |
The number of characters to return. |
Return values
A string of text of the specified length.
Examples
-- LEFT, RIGHT, MID and LEN are the basic string-manipulation functions DEFINE VAR Val = "DAX is so cool!" EVALUATE { ( "LEFT ( Val, 3 ) ", LEFT ( Val, 3 ) ), ( "RIGHT ( Val, 5 )", RIGHT ( Val, 5 ) ), ( "MID ( Val, 11, 4 )", MID ( Val, 11, 4 ) ), ( "LEN ( Val )", LEN ( Val ) ) }
Value1 | Value2 |
---|---|
LEFT ( Val, 3 ) | DAX |
RIGHT ( Val, 5 ) | cool! |
MID ( Val, 11, 4 ) | cool |
LEN ( Val ) | 15 |
EVALUATE VAR SSN = "123-45-6789" VAR SecureSSN = "XXX-XX-" & MID ( SSN, 8, 3 ) & "X" RETURN { SecureSSN }
Value |
---|
XXX-XX-678X |
Related functions
Other related functions are:
Last update: Nov 14, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/mid-function-dax