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
juhoneyighot
Helper III
Helper III

Get the Characters from a text using DAX

Hello!

I need help to get the characters from a certain text using DAX. I have this Column "JobType". See table below.

JobtypeNC.INPhaseStatus
NC 120_Rough Builder Walk__10Not StartedNCNC 120_Rough Builder Walk10Not Started
NC.IN 720_Dehu_Estimate__90CompleteNC.INNC.IN 720_Dehu_Estimate90Complete
IN 622_CO EQ_QC__90CompleteININ 622_CO EQ_QC90Complete
Install_Estimates   

 I have to use a DAX to get the characters for the Phase and Status Column from Jobtype column with this condition. If Column NC.IN is "" then ""

 

else 

 

Phase column is extracted before the __(2underscores)

Status column is extracted after the __(2underscores)

 

I am confused what correct DAX formula to use. 

 

Thank you.

1 ACCEPTED SOLUTION

you need creat a measure

Screenshot_1.png

View solution in original post

8 REPLIES 8
Ahmedx
Super User
Super User

pls try this

Status = IF(
    NOT ISBLANK( 'Table'[NC.IN] ),
    PATHITEM( SUBSTITUTE( 'Table'[Jobtype], "__", "|" ), 2 ),
    ""
)

Screenshot_2.png

you need creat a measure

Screenshot_1.png

@Ahmedx The solution works for Status Column.

 

Can I also ask help for the Phase Column. Same condition with Status column but Phase Column is extracted before the 2_(two Underscores).

 

Thank you.

this is ok now.. I use the PATHITEMREVERSE Dax.

 

Thank you.

@Ahmedx 

I tried it but the error is this.

juhoneyighot_0-1700492272911.png

 

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try these in custom columns:

 

Phase= If ([NC.IN] = "", "", left([Jobtype], search("__",[Jobtype],,0)))
 
Status= If ([NC.IN] = "", "", right([Jobtype], len([Jobtype]) - search("__",[Jobtype],,0)))
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Hi @DOLEARY85 

if i added the Calculated Phase column the error is this.

juhoneyighot_1-1700492734825.png

When I click see details 

juhoneyighot_2-1700492770852.png

 

I assume you're using direct query mode which is going to make it difficult with DAX in calculated columns as what you can do is limited, you could try it as a measure but you have to be a little creative:

 

Phase = If (CALCULATE(max([NC.IN])) = "", "", left(CALCULATE(max([Jobtype])), search("__",CALCULATE(max([Jobtype])),,0)))
 
 
If this doesn't work you might be better creating a view in the source with the additional fields and then connecting that view to Power BI.
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

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.

Top Solution Authors