Home » DAX » DAX MID Function

DAX MID Function

DAX MID Function

DAX function MID is used to returns a string of characters from the middle of a text string, given a starting position and length. It’s comes under Text DAX function category.

Syntax:

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




Description:

S no. Parameter Description
1 text The text string from which you want to extract the characters, or a column that contains text.
2 start_num The position of the first character you want to extract. Positions start at 1.
3 num_chars The number of characters to return.

So, Let’s start with an example, download the sample Dataset from below link-

Now follow these steps-





Step-1: Add one table visual into report page with some columns.

Table visual in Power BI

Table visual in Power BI

Step-2: Create a new calculated column.

Right click on dataset name > click on New column > and write below DAX.

MID Result = MID('Global-Superstore'[Region], 2, 3)

Step-3: Now add new column into Table visual.

It returns a substring from the Region column. Substring starts at position no 2 and ends when string length reaches to 3.

MID DAX

MID DAX

Refer other DAX post – DAX Tutorials




Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.

Leave a Reply