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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Jenny_Sommet
New Member

DAX formula to extract text before and after special character

Hello!

 

I am new to the community and hoping for some help! In the column below, I only want to extract the text that comes after '- ' and before ' -' for the entire column of values. Please can you help with DAX calculation? I am unable to use PowerQuery for various reasons.

 

EDPC - 2023.Q1 - DP (want to extract 2023.Q1)

LRM - 2023.1 - UG - DP (want to extract 2023.1)

LRCM - 2022.2 - PG - DP (want to extract 2022.2)

 

Thank you for your help!

2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @Jenny_Sommet

Please try

Column2 =
VAR String = 'Table'[Column1]
VAR Items =
SUBSTITUTE ( String, " - ", "|" )
RETURN
PATHITEM ( Items, 2 )

View solution in original post

@Jenny_Sommet 

Column2 =
VAR String = 'Table'[Column1]
VAR Items =
SUBSTITUTE ( String, " - ", "|" )

VAR Length = 

COALESCE ( PATHLENGTH ( Items ), 1 )
RETURN
PATHITEM ( Items, Length )

View solution in original post

4 REPLIES 4
Jenny_Sommet
New Member

@tamerj1  Really appreciate your support!

Jenny_Sommet
New Member

Thank you so much for the fast response! @tamerj1 

 

Can you confirm how I can modify the DAX to only extract the characters after '- ' also?

 

EDPC - 2023.Q1 - DP (want to extract DP)

LRM - 2023.1 - UG - DP (want to extract DP)

LRCM - 2022.2 - PG - DP (want to extract DP)

@Jenny_Sommet 

Column2 =
VAR String = 'Table'[Column1]
VAR Items =
SUBSTITUTE ( String, " - ", "|" )

VAR Length = 

COALESCE ( PATHLENGTH ( Items ), 1 )
RETURN
PATHITEM ( Items, Length )

tamerj1
Super User
Super User

Hi @Jenny_Sommet

Please try

Column2 =
VAR String = 'Table'[Column1]
VAR Items =
SUBSTITUTE ( String, " - ", "|" )
RETURN
PATHITEM ( Items, 2 )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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