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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Extract name from email

I am trying to create a custom column that extracts the name from the email address.  I need to remove both the domain name and the . between the first and last name and then i was going to have it correctly capitlised.  

 

But when i run the code below i get an error:

Expression.Error: We cannot convert the value "first last@company..." to type List.
Details:
Value=first last@company co
Type=[Type]

 

Text.Proper([Assigned Tech],Text.BeforeDelimiter([Assigned Tech],"@",Text.Replace([Assigned Tech],"."," ")))

 

1 ACCEPTED SOLUTION
FrankAT
Community Champion
Community Champion

Hi @Anonymous ,

if you have a single value like peter.ball@domain.uk.au you can use the following M-code

 

= Text.Proper(Text.BeforeDelimiter(Text.Replace("peter.ball@domain.uk.au", ".", " "),"@"))

 

to get this:

 

01-07-_2021_23-17-20.png

 

If you have a column in a table use the following M-code:

 

// Data
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKkgtSS3SS0rMyXFIyc9NzMzTK83WSyxVio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"E-Mail Address" = _t]),
    #"Extracted Text Before Delimiter" = Table.TransformColumns(Source, {{"E-Mail Address", each Text.BeforeDelimiter(_, "@"), type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Extracted Text Before Delimiter","."," ",Replacer.ReplaceText,{"E-Mail Address"}),
    #"Capitalized Each Word" = Table.TransformColumns(#"Replaced Value",{{"E-Mail Address", Text.Proper, type text}})
in
    #"Capitalized Each Word"

 

01-07-_2021_23-20-47.png

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

 

 

 

 

 

 

View solution in original post

1 REPLY 1
FrankAT
Community Champion
Community Champion

Hi @Anonymous ,

if you have a single value like peter.ball@domain.uk.au you can use the following M-code

 

= Text.Proper(Text.BeforeDelimiter(Text.Replace("peter.ball@domain.uk.au", ".", " "),"@"))

 

to get this:

 

01-07-_2021_23-17-20.png

 

If you have a column in a table use the following M-code:

 

// Data
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKkgtSS3SS0rMyXFIyc9NzMzTK83WSyxVio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"E-Mail Address" = _t]),
    #"Extracted Text Before Delimiter" = Table.TransformColumns(Source, {{"E-Mail Address", each Text.BeforeDelimiter(_, "@"), type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Extracted Text Before Delimiter","."," ",Replacer.ReplaceText,{"E-Mail Address"}),
    #"Capitalized Each Word" = Table.TransformColumns(#"Replaced Value",{{"E-Mail Address", Text.Proper, type text}})
in
    #"Capitalized Each Word"

 

01-07-_2021_23-20-47.png

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

 

 

 

 

 

 

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.