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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
unnijoy
Post Partisan
Post Partisan

Extracting text before a delimiter

I have  a column ( Name & ID) that contain name and employee ID. i need to extract only the name using a dax.

 

for example the name is Mathew  V James (12345).

 

Now i need to get the text as Mathew V James.  

 

The Name & ID column is a calculated column. And i don't want to make any change in that column.  

 

Please help me with a measure that i need to use on a visula .

1 ACCEPTED SOLUTION

Hi @unnijoy ,

 

Does your Name & ID column contain data like "AA" without parentheses? If so, you will get an error when using the DAX provided by @amitchandak . 

 

vkkfmsft_0-1627260733326.png

 

Try the following formula:

 

Name = 
LEFT(
    'Table'[Name & ID],
    SEARCH(
        "(", 
        'Table'[Name & ID],
        ,
        LEN('Table'[Name & ID]) + 1
    ) - 1
)

vkkfmsft_1-1627261556828.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
Nikita_Arora
New Member

Hi @v-kkf-msft ,

 

I'm Facing the same isssue if i try to fix FIND function then i usually get RIGHT function error . Here is the screenshot for your reference

Nikita_Arora_1-1659004283601.png

 

it's working fine without using variable but showing error once i'm trying to optimise this dax using variables




amitchandak
Super User
Super User

@unnijoy , You need to have a new column for that. Best is split this in power query based on (

 

In dax a new column

left([name], search("(", [Name],,0)-1)

 

hi @amitchandak ,

 

An argument of function 'LEFT' has the wrong data type or has an invalid value. this is the error message that i am getting. I check the column type. Its in Text.

Hi @unnijoy ,

 

Does your Name & ID column contain data like "AA" without parentheses? If so, you will get an error when using the DAX provided by @amitchandak . 

 

vkkfmsft_0-1627260733326.png

 

Try the following formula:

 

Name = 
LEFT(
    'Table'[Name & ID],
    SEARCH(
        "(", 
        'Table'[Name & ID],
        ,
        LEN('Table'[Name & ID]) + 1
    ) - 1
)

vkkfmsft_1-1627261556828.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

NAME = LEFT('Table'[Name & ID],SEARCH("(",'Customer Data'[Customer Name],1,0)-1)

@v-kkf-msft ,

 

Thanks a Lot for your help 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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