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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
i_stanescu_ro
Helper I
Helper I

"Clean" e-mail addressee and use the person's name

Hi everyone!

 

Hope you can help me put!

 

I have in BI this list of emails (fake ones). Some of them are repeating. I need to do someting in BI to remove "@test.com" and as an example -  catalina.maruntelu@test.com to be Catalina Maruntelu.

 

And one more thing, the emails in red have the "-xx" thing at the end of the name, I'm gona need to remove that too..

 

And another thing, example -  Iasmina-Cornelia.Farcas@test.com should be Iasmina-Cornelia Farcas.

 

 

Thanks so much!

 

fake emails
elena.popescu-ab@test.com
elena.popescu-ab@test.com
mihaela.groza-sv@test.com
mihaela.groza-sv@test.com
elena.popescu-ab@test.com
Maria.Moldovan-MS@test.com
elena.popescu-ab@test.com
maria.moldovan-ms@test.com
maria.moldovan-ms@test.com
Maria.Moldovan-MS@test.com
elena.popescu-ab@test.com
iosif-george.verinica@test.com
catalina.maruntelu@test.com
Ioana.Avram@test.com
carmen.stoian@test.com
cristina.ghinga@test.com
elena-alina.nica@test.com
Leonida.Cheregi@test.com
sinziana.calita@test.com
ion.schintee@test.com
carmen.codreanu@test.com
Marius-Adrian.Lengyel@test.com
Iasmina-Cornelia.Farcas@test.com
aurora.kosztandi@test.com
1 ACCEPTED SOLUTION

pls try this

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZFBagMxDEXvknXtMzQECoXMqsuQxY9H9YjaUpA9A53T12kpdCahJXT9/L+epcNhQ4kE/qxnKmF0OD1WKtUHzZvjw1808wBK8NF0hivTPfT35g7G8J2mXieI617u0voM5+9wLnfhf41mLfzqIqlF8hMZCwcsnwRUJG4dzWOUSmlc8mdFg9vJkNdByyS+VGXIChmXeumMA0vEDWP3NfNaZ08q3MPvBjKKvISFZeaLTmjxivVfm0xoAyvRTdOgvRFkvN7vWNy2b2sWvyeJ75RWK0DJzdbt1IRSu8YTLGB1J4ymBv+mZa6Q/qf58QM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"fake emails" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"fake emails", type text}}),
#"Inserted Text Before Delimiter" = Table.AddColumn(#"Changed Type", "Text Before Delimiter", each Text.BeforeDelimiter([fake emails], "@"), type text),
#"Added Custom" = Table.AddColumn(#"Inserted Text Before Delimiter", "Custom", each if Text.Start(Text.End([Text Before Delimiter],3),1)="-"

then Text.Start([Text Before Delimiter],Text.Length([Text Before Delimiter])-3) else [Text Before Delimiter]),
#"Replaced Value" = Table.ReplaceValue(#"Added Custom","-","-/",Replacer.ReplaceText,{"Custom"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",".","/",Replacer.ReplaceText,{"Custom"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Replaced Value1", "Custom", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Custom.1", "Custom.2", "Custom.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom.1", type text}, {"Custom.2", type text}, {"Custom.3", type text}}),
#"Capitalized Each Word" = Table.TransformColumns(#"Changed Type1",{{"Custom.1", Text.Proper, type text}, {"Custom.2", Text.Proper, type text}}),
#"Capitalized Each Word1" = Table.TransformColumns(#"Capitalized Each Word",{{"Custom.2", Text.Proper, type text}}),
#"Merged Columns" = Table.CombineColumns(#"Capitalized Each Word1",{"Custom.1", "Custom.2", "Custom.3"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
#"Removed Columns" = Table.RemoveColumns(#"Merged Columns",{"Text Before Delimiter"})
in
#"Removed Columns"

 

pls see the attachment below





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

Proud to be a Super User!




View solution in original post

6 REPLIES 6
ryan_mayu
Super User
Super User

@i_stanescu_ro 

maybe you can try this is PQ

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZFBagMxDEXvknXtMzQECoXMqsuQxY9H9YjaUpA9A53T12kpdCahJXT9/L+epcNhQ4kE/qxnKmF0OD1WKtUHzZvjw1808wBK8NF0hivTPfT35g7G8J2mXieI617u0voM5+9wLnfhf41mLfzqIqlF8hMZCwcsnwRUJG4dzWOUSmlc8mdFg9vJkNdByyS+VGXIChmXeumMA0vEDWP3NfNaZ08q3MPvBjKKvISFZeaLTmjxivVfm0xoAyvRTdOgvRFkvN7vWNy2b2sWvyeJ75RWK0DJzdbt1IRSu8YTLGB1J4ymBv+mZa6Q/qf58QM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"fake emails" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"fake emails", type text}}),
#"Added Custom Column" = Table.AddColumn(#"Changed Type", "Custom", each let splitfakeemails = Splitter.SplitTextByDelimiter(".", QuoteStyle.None)([fake emails]), splitsplitfakeemails1 = Splitter.SplitTextByDelimiter("-", QuoteStyle.None)(splitfakeemails{1}?) in Text.Combine({Text.Start(Text.Proper([fake emails]), 5), Text.Middle(splitfakeemails{0}?, 5), " ", Text.Proper(splitsplitfakeemails1{0}?)}), type text),
#"Extracted Text Before Delimiter" = Table.TransformColumns(#"Added Custom Column", {{"Custom", each Text.BeforeDelimiter(_, "@"), type text}})
in
#"Extracted Text Before Delimiter"

 

11.PNG





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

Proud to be a Super User!




Hi again

 

I found out where to put the code, all good now, thanks!

 

I am left with:

 

line 12 - george should be George

line 17 - the same as above

line 20 - we have an extra "S" in the name

Thanks so much!

 

Not sure where to insert the code you gave me... Can you please help? Thanbks so much for your time!

 

And:

line 12 - george should be George

line 17 - the same as above

line 20 - we have an extra "S" in the neam

pls try this

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZFBagMxDEXvknXtMzQECoXMqsuQxY9H9YjaUpA9A53T12kpdCahJXT9/L+epcNhQ4kE/qxnKmF0OD1WKtUHzZvjw1808wBK8NF0hivTPfT35g7G8J2mXieI617u0voM5+9wLnfhf41mLfzqIqlF8hMZCwcsnwRUJG4dzWOUSmlc8mdFg9vJkNdByyS+VGXIChmXeumMA0vEDWP3NfNaZ08q3MPvBjKKvISFZeaLTmjxivVfm0xoAyvRTdOgvRFkvN7vWNy2b2sWvyeJ75RWK0DJzdbt1IRSu8YTLGB1J4ymBv+mZa6Q/qf58QM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"fake emails" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"fake emails", type text}}),
#"Inserted Text Before Delimiter" = Table.AddColumn(#"Changed Type", "Text Before Delimiter", each Text.BeforeDelimiter([fake emails], "@"), type text),
#"Added Custom" = Table.AddColumn(#"Inserted Text Before Delimiter", "Custom", each if Text.Start(Text.End([Text Before Delimiter],3),1)="-"

then Text.Start([Text Before Delimiter],Text.Length([Text Before Delimiter])-3) else [Text Before Delimiter]),
#"Replaced Value" = Table.ReplaceValue(#"Added Custom","-","-/",Replacer.ReplaceText,{"Custom"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",".","/",Replacer.ReplaceText,{"Custom"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Replaced Value1", "Custom", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Custom.1", "Custom.2", "Custom.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom.1", type text}, {"Custom.2", type text}, {"Custom.3", type text}}),
#"Capitalized Each Word" = Table.TransformColumns(#"Changed Type1",{{"Custom.1", Text.Proper, type text}, {"Custom.2", Text.Proper, type text}}),
#"Capitalized Each Word1" = Table.TransformColumns(#"Capitalized Each Word",{{"Custom.2", Text.Proper, type text}}),
#"Merged Columns" = Table.CombineColumns(#"Capitalized Each Word1",{"Custom.1", "Custom.2", "Custom.3"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
#"Removed Columns" = Table.RemoveColumns(#"Merged Columns",{"Text Before Delimiter"})
in
#"Removed Columns"

 

pls see the attachment below





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

Proud to be a Super User!




Perfect!

 

Thanks so much for your time and help!!!

you are welcome





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

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.