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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
RENJITH_R_S
Resolver II
Resolver II

DAX for Split column by delimitor at the right most

Hello Friends, can you help me on this issue
Sub Category returns the text after the last delimitor and Main Category returns the text before the last delimitor
Please provide the dax formulas for Main Category and Sub Category. See the scrren shot

 

RENJITH_R_S_0-1747893479172.png

 

1 ACCEPTED SOLUTION

@bhanu_gautam Thanks for the input, but not works.

I modified the formula as

MainCategory =
VAR CategoryText = 'Table'[Category]
VAR LastDelimiterPosition = LEN(CategoryText) - FIND("~", SUBSTITUTE(CategoryText, "-", "~", LEN(CategoryText) - LEN(SUBSTITUTE(CategoryText, "-", ""))), 1)
RETURN Left(CategoryText, LEN(CategoryText) - LastDelimiterPosition-1)

SubCategory =
VAR CategoryText = 'Table'[Category]
VAR LastDelimiterPosition = LEN(CategoryText) - FIND("~", SUBSTITUTE(CategoryText, "-", "~", LEN(CategoryText) - LEN(SUBSTITUTE(CategoryText, "-", "")))) + 1
RETURN Right(CategoryText, LastDelimiterPosition - 1)


View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@RENJITH_R_S , For Main Category

Main Category =
VAR CategoryText = [Category]
VAR LastDelimiterPosition = LEN(CategoryText) - FIND("~", SUBSTITUTE(CategoryText, "-", "~", LEN(CategoryText) - LEN(SUBSTITUTE(CategoryText, "-", ""))), 1)
RETURN LEFT(CategoryText, LastDelimiterPosition - 1)

 

Sub Category

Sub Category =
VAR CategoryText = [Category]
VAR LastDelimiterPosition = LEN(CategoryText) - FIND("~", SUBSTITUTE(CategoryText, "-", "~", LEN(CategoryText) - LEN(SUBSTITUTE(CategoryText, "-", ""))), 1)
RETURN RIGHT(CategoryText, LEN(CategoryText) - LastDelimiterPosition)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






@bhanu_gautam Thanks for the input, but not works.

I modified the formula as

MainCategory =
VAR CategoryText = 'Table'[Category]
VAR LastDelimiterPosition = LEN(CategoryText) - FIND("~", SUBSTITUTE(CategoryText, "-", "~", LEN(CategoryText) - LEN(SUBSTITUTE(CategoryText, "-", ""))), 1)
RETURN Left(CategoryText, LEN(CategoryText) - LastDelimiterPosition-1)

SubCategory =
VAR CategoryText = 'Table'[Category]
VAR LastDelimiterPosition = LEN(CategoryText) - FIND("~", SUBSTITUTE(CategoryText, "-", "~", LEN(CategoryText) - LEN(SUBSTITUTE(CategoryText, "-", "")))) + 1
RETURN Right(CategoryText, LastDelimiterPosition - 1)


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.