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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
SteveMForm
Helper III
Helper III

Reformatting internal email address into First Name + Last Name

Hi Folks

I have various columns where name values are held in the form of an email Title in the following format:

 

Lastname, Firstname (Department)

 

I want to reformat to: Firstname Lastname

 

 

(so stripping out the brackets and text in them, changing order to have Firstname first, and removing the comma).

 

What's the best way to do this?

 

Thanks

1 ACCEPTED SOLUTION
Joe_Barry
Super User
Super User

Hi @SteveMForm 

 

Do the Values look like this Barry, Joe (BI) ?

 

In Power Query, try the following

 

  • Highlight the column
  • In the ribbon, click on Add Column
  • Then Text after Delimter and choose , (there is an empty space after the , hit your spacebar) This will give a column with the First Name and Department
  • Then Text before Delimter and choose , This will give a column with the Family Name
  • Now Highlight the First column you extracted
  • Then Text after Delimter and choose space (hit your spacebar) This will give a column with the Department
  • Then Text before Delimter and choose space (hit your spacebar) This will give a column with the First name
  • To get First Name Last Name  Highlight the First Name Column and then the Last name Column
  • In the ribbon go to the Transform Tab > Merge Columns You can Name the new column and in the Separator section add a Space

Joe_Barry_0-1717589042470.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WckosKqrUUfDKT1XQcPLUVIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Email." = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Email.", type text}}),
    #"Inserted Text After Delimiter" = Table.AddColumn(#"Changed Type", "Text After Delimiter", each Text.AfterDelimiter([#"Email."], ", "), type text),
    #"Inserted Text Before Delimiter" = Table.AddColumn(#"Inserted Text After Delimiter", "Text Before Delimiter", each Text.BeforeDelimiter([#"Email."], ","), type text),
    #"Inserted Text After Delimiter1" = Table.AddColumn(#"Inserted Text Before Delimiter", "Text After Delimiter.1", each Text.AfterDelimiter([Text After Delimiter], " "), type text),
    #"Inserted Text Before Delimiter1" = Table.AddColumn(#"Inserted Text After Delimiter1", "Text Before Delimiter.1", each Text.BeforeDelimiter([Text After Delimiter], " "), type text),
    #"Merged Columns" = Table.CombineColumns(#"Inserted Text Before Delimiter1",{"Text Before Delimiter.1", "Text Before Delimiter"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged")
in
    #"Merged Columns"

 

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


View solution in original post

3 REPLIES 3
SteveMForm
Helper III
Helper III

Hi @Joe_Barry - I used your method and all worked fine. 

 

BTW- stupid question, but once I have created the merged column, and deleted the 'intermediary' ones, the merged column will produce the desired format with new data entries?

@Anonymous will try your method on next table - so thnaks for providing an alternate method.

Anonymous
Not applicable

Thanks for the reply from @Joe_Barry , please allow me to provide another insight:

 

Hi @SteveMForm ,

 

You can try below formula to create calculated column:

FormattedName = 
VAR FullName = Employees[EmailTitle]
VAR CommaPosition = FIND(",", FullName, 1, LEN(FullName))
VAR FirstName = MID(FullName, CommaPosition + 2, FIND("(", FullName, CommaPosition) - CommaPosition - 3)
VAR LastName = LEFT(FullName, CommaPosition - 1)
RETURN FirstName & " " & LastName

vkongfanfmsft_0-1717640313499.png

 

Best Regards,
Adamk Kong

 

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

Joe_Barry
Super User
Super User

Hi @SteveMForm 

 

Do the Values look like this Barry, Joe (BI) ?

 

In Power Query, try the following

 

  • Highlight the column
  • In the ribbon, click on Add Column
  • Then Text after Delimter and choose , (there is an empty space after the , hit your spacebar) This will give a column with the First Name and Department
  • Then Text before Delimter and choose , This will give a column with the Family Name
  • Now Highlight the First column you extracted
  • Then Text after Delimter and choose space (hit your spacebar) This will give a column with the Department
  • Then Text before Delimter and choose space (hit your spacebar) This will give a column with the First name
  • To get First Name Last Name  Highlight the First Name Column and then the Last name Column
  • In the ribbon go to the Transform Tab > Merge Columns You can Name the new column and in the Separator section add a Space

Joe_Barry_0-1717589042470.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WckosKqrUUfDKT1XQcPLUVIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Email." = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Email.", type text}}),
    #"Inserted Text After Delimiter" = Table.AddColumn(#"Changed Type", "Text After Delimiter", each Text.AfterDelimiter([#"Email."], ", "), type text),
    #"Inserted Text Before Delimiter" = Table.AddColumn(#"Inserted Text After Delimiter", "Text Before Delimiter", each Text.BeforeDelimiter([#"Email."], ","), type text),
    #"Inserted Text After Delimiter1" = Table.AddColumn(#"Inserted Text Before Delimiter", "Text After Delimiter.1", each Text.AfterDelimiter([Text After Delimiter], " "), type text),
    #"Inserted Text Before Delimiter1" = Table.AddColumn(#"Inserted Text After Delimiter1", "Text Before Delimiter.1", each Text.BeforeDelimiter([Text After Delimiter], " "), type text),
    #"Merged Columns" = Table.CombineColumns(#"Inserted Text Before Delimiter1",{"Text Before Delimiter.1", "Text Before Delimiter"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged")
in
    #"Merged Columns"

 

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.