Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
Hi all, I have a large collection of customer emails, and I need to sort them from emails that are usable and those that are not. I have them all in one column, and I would like to search that column for text value "@" and ".com". This is because some of the values in the email column do not include these values, and so they aren't usable. For example, I want to gather all emails like
"acb1234@gmail.com"
"tiger67@yahoo.com"
"78steelers@aol.com"
And not anything else, like phone numbers, blanks, or non-email addresses. Is there a way to do this? Let me know if you need additional information, thank you
Solved! Go to Solution.
@abeirne , Sorry Syntax issue .
correct one is
if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0
M test code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSnRITErWS87PVYrViVZKcUgB8vJSS8C85LIkMG1oZKwUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0)
in
#"Added Custom"
@abeirne , You can use filter in power query. USe custom option and use OR
or create a column like this
if Text.Contains("@",[Col]) or Text.Contains(".com",[Col]) then 1 else 0
and filter row having value of this column =1 in power query
if Text.Contains("@",[Customer_Email_Address]) or
Text.Contains(".com", [Customer_Email_Address]) then [Customer_Email_Address] else "BBBB"
Unfornately that is only resulting in BBBB, I am not sure why, even when I change the 'or' to 'and'.
I also have this which is semi-working:
if List.AnyTrue(List.Transform( { "@" , ".com"}, (substring) => Text.Contains( [Customer_Email_Address], substring ) ) ) = true then [Customer_Email_Address] else "BBBBBB")
How to I add "and" in this? Right now it is pulling both values, resulting in outputs like "@DENIED" and other incorrect email addresses. Thank you for your help in this.
@abeirne , Sorry Syntax issue .
correct one is
if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0
M test code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSnRITErWS87PVYrViVZKcUgB8vJSS8C85LIkMG1oZKwUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0)
in
#"Added Custom"
Hi thank you very much. Is there a way I can make a list of things not to include in results, as well as including and Text.Contains([Column1],"@"), etc?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
17 | |
10 | |
10 | |
8 | |
6 |
User | Count |
---|---|
18 | |
16 | |
15 | |
12 | |
10 |