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
Anonymous
Not applicable

split name surname in separate column

Hi, I went to the forum, but I have not found anything that suits my case.

I have a colum like this ( name and surname)

MARCO DI BENEDETTO

MICHELE DE ROBERTO

I'd like to split into 2 separate colum

namesurname
MARCODI BENEDETTO
MICHELEDE ROBERTO

 

If I split column by delimiters ( space) I obtain something wrong due to surname with 2 parts ( DI BENEDETTO)....

any idea is appreciated !

Thanks

Diego

7 REPLIES 7
mangaus1111
Solution Sage
Solution Sage

Otherwise you can use the macro Text before and after Delimiter from here

mangaus1111_0-1667919423536.png

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

Anonymous
Not applicable

Good function but don't separate correctly ;-/

If I use Text before delimiter on

MARCO DI BENEDETTO

I obtain

DI

instead of

DI BENEDETTO 

 

😕

 

 

Hi @Anonymous ,

see my solution in the pbi file

https://1drv.ms/u/s!Aj45jbu0mDVJi0TPmFFEFXXd-Zn1?e=BeuR8g

 

mangaus1111
Solution Sage
Solution Sage

Ciao Diego,

you can use this in Power Query:

For Surname

= Table.AddColumn(#"Inserted Text Length", "Text After Delimiter", each Text.AfterDelimiter([Name], " "), type text)

 

For Name

= Table.AddColumn(#"Removed Columns", "Text Before Delimiter", each Text.BeforeDelimiter([Name], " "), type text)

 

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

RamiKAL
New Member

Hi, on Power query right click on the column, split by delimiter and then choose "Left-most delimiter". KLL

Gengar
Resolver I
Resolver I

Hi @Anonymous ,

 

This is my data:

Gengar_0-1667917855366.png

You can create two calculated column:

 

_name = LEFT([Name],FIND(" ",[Name])-1)
 
surname =
VAR NAME1 = RIGHT([Name],LEN([Name])-FIND(" ",[Name]))
VAR NAME2 = RIGHT(NAME1,LEN(NAME1)-FIND(" ",NAME1))
return NAME2
 
Gengar_1-1667917909903.png

 

Hope my answer could help you!

Ganger

 

Anonymous
Not applicable

Ehm, in your solution we lost part of surname (DI or DE), correct surnema is

DI BENEDETTO

DE ROBERTO

...that's my headache! 😉

 

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.