Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

DAX extract text between delimiter

Hi, 

How can I get the red text below in DAX? A text after equal and before semicolon

AAA=BBB,CCC=DDD;EEE=FFF

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Create a Calculated Column

 

First Derived Column =
VAR FirstEqual =
    FIND (
        "=",
        'Table'[Sorting Text],
        1
    )
VAR SecondEqual =
    FIND (
        "=",
        'Table'[Sorting Text],
        FirstEqual + 1
    )
VAR Thirdampersand =
    FIND (
        ";",
        'Table'[Sorting Text],
        SecondEqual + 1
    )
RETURN
    MID (
        'Table'[Sorting Text],
        SecondEqual + 1,
        Thirdampersand - SecondEqual - 1
    )

 

 

1.jpg

 

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)


Did I answer your question? Mark my post as a solution!

View solution in original post

5 REPLIES 5
AntrikshSharma
Super User
Super User

You can try this too for learning new trick:

GetText =
VAR OriginalText = 'Table'[Column1]
VAR CountOfEqualSign =
    LEN ( 'Table'[Column1] ) - LEN ( SUBSTITUTE ( 'Table'[Column1], "=", "" ) )
VAR AddCaret =
    SUBSTITUTE ( OriginalText, "=", "^", CountOfEqualSign - 1 )
VAR FirstCharAfterCaret =
    SEARCH ( "^", AddCaret ) + 1
VAR SemiColonPostion =
    SEARCH ( ";", OriginalText )
VAR Result =
    MID ( AddCaret, FirstCharAfterCaret, SemiColonPostion - FirstCharAfterCaret )
RETURN
    Result

gettext.PNG

harshnathani
Community Champion
Community Champion

HI @Anonymous ,

 

Does all your column have the same pattern? i.e an = and  ;

 

 

You can also have a look at these

 

https://community.powerbi.com/t5/Desktop/Extract-text-Between-Delimiters-with-varying-text/td-p/670340

https://www.wiseowl.co.uk/blog/s2535/text-between-delimiters.htm

https://community.powerbi.com/t5/Desktop/DAX-extracting-string-using-delimiter/td-p/287840

 

 

Regards,
Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

 yes same pattern

the first and second post are power query which is not what i need

the third post, I tried to replicate but failed

Hi @Anonymous ,

 

Create a Calculated Column

 

First Derived Column =
VAR FirstEqual =
    FIND (
        "=",
        'Table'[Sorting Text],
        1
    )
VAR SecondEqual =
    FIND (
        "=",
        'Table'[Sorting Text],
        FirstEqual + 1
    )
VAR Thirdampersand =
    FIND (
        ";",
        'Table'[Sorting Text],
        SecondEqual + 1
    )
RETURN
    MID (
        'Table'[Sorting Text],
        SecondEqual + 1,
        Thirdampersand - SecondEqual - 1
    )

 

 

1.jpg

 

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)


Did I answer your question? Mark my post as a solution!

Hi Harsh, I am having a similar situation. I want to extract the string between "/" in the longer string, such as: "abc/def/ghijk". I used the same formula you gave and substituted with my own variables:

 

Division =
VAR FirstLevel =
    FIND ("/", GetFolders[FullyQualifiedName], 1)
VAR SecondLevel =
    FIND ("/", GetFolders[FullyQualifiedName], FirstLevel + 1)
RETURN
    MID (GetFolders[FullyQualifiedName], FirstLevel + 1, SecondLevel - 1)
 
The error I am getting is: "The search Text provided to function 'FIND' could not be found in the given text." I am suspecting that this is because not all strings have 2 "/". Some have 1 and some don't have any at all. I am only interested in the ones with 2 "/" and the rest can be just blank or empty.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.