MID Function (DAX)

How does the MID function (DAX) work?

MID function returns a string of characters, given the starting position and length, from the middle of a text string.

MID Formula Syntax

= MID(
     <text>, <start_num>, <num_chars>
)

How do you use the MID function?

A text string with the specified length.

Related Blog Posts

Related Support Forum Posts

Extract the first number(s) from a text string using a calculated column
Calculate First Day of month for different countries

Considerations when using the MID function

Whereas Microsoft Excel has various functions for dealing with languages of single byte and double byte characters, DAX uses Unicode and stores all characters of the same length.

Related Video Tutorials

Formula examples using the MID function

The following examples return the same results, the first 5 letters of the column, [ResellerName]. The first example uses the fully qualified name of the column and specifies the starting point; the second example omits the table name and the parameter, num_chars.

= MID (
    ‘Reseller'[ResellerName],5,1
)

= MID (
    [ResellerName,5]
)

The results are the same if you use the following formula:

= LEFT (
    [ResellerName],5
)

Related DAX Functions

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.


Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide
Membership