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
rosemilo
Frequent Visitor

Extracting String Using LEFT and SEARCH function

Hello,

 

I'm trying to extract the number before the colon (see example below) using DAX. 

rosemilo_0-1652293205883.png

 

Here are the steps I did:

1. To return the specified number of characters I want (it worked)

   c_Search Request Target Time = SEARCH(":", 'MyRequest_Consolidated'[Request Target Time],,LEN('MyRequest_Consolidated'[Request Target Time]))-1

2. To extract the number before the colon 

c_Request Target Time = LEFT('MyRequest_Consolidated'[Request Target Time], MyRequest_Consolidated[c_Search Request Target Time]) 
The second formula returns the error below:
rosemilo_1-1652293420343.png

 

Is there any other way to extract the number I need before the colon (:)? The data type of the column is "Text". Thank you!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @rosemilo 

please try

 

c_Request Target Time =
IF (
    MyRequest_Consolidated[c_Search Request Target Time] > 0,
    LEFT (
        'MyRequest_Consolidated'[Request Target Time],
        MyRequest_Consolidated[c_Search Request Target Time]
    )
)

 

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @rosemilo 

please try

 

c_Request Target Time =
IF (
    MyRequest_Consolidated[c_Search Request Target Time] > 0,
    LEFT (
        'MyRequest_Consolidated'[Request Target Time],
        MyRequest_Consolidated[c_Search Request Target Time]
    )
)

 

Thank you! It worked! 😊

tamerj1
Super User
Super User

@rosemilo 

Can you please provide sample data?

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.