Forum Discussion
List as input criteria for Text.StartsWith
- 9 years ago
Hi AM_XRX,
I combine the two tables into one, and it's easy to comparable, please review the following steps.
1. Add a customer coumn using the formula.= Table.AddColumn(#"Changed Type", "Custom", each Table.AddColumn(Table1,"Allranges",each Table1))
2. Expand the Ranges column, you will get the following table.
3. I filter the table using Text.StartsWith function. Then delete the Ranges column, just leave the expected Ip Address column, you will get the expected result.
Here is my Power Query statement.let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NcrBCcAgEAXRXjzLwH7/LrEWsf82EpQc3zBrtQgk0tht9+OJeHQlwiYS1x+UgyzG9+8X", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"IP Address" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"IP Address", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table.AddColumn(Table1,"Allranges",each Table1)), #"Expanded Custom1" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Ranges"}, {"Custom.Ranges"}), #"A"=Table.SelectRows(#"Expanded Custom1", each Text.StartsWith([IP Address], [Custom.Ranges])), #"Removed Columns" = Table.RemoveColumns(A,{"Custom.Ranges"}) in #"Removed Columns"
Best Regards,
Angelia
Hi AM_XRX,
I combine the two tables into one, and it's easy to comparable, please review the following steps.
1. Add a customer coumn using the formula.
= Table.AddColumn(#"Changed Type", "Custom", each Table.AddColumn(Table1,"Allranges",each Table1))
2. Expand the Ranges column, you will get the following table.
3. I filter the table using Text.StartsWith function. Then delete the Ranges column, just leave the expected Ip Address column, you will get the expected result.
Here is my Power Query statement.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NcrBCcAgEAXRXjzLwH7/LrEWsf82EpQc3zBrtQgk0tht9+OJeHQlwiYS1x+UgyzG9+8X", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"IP Address" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"IP Address", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table.AddColumn(Table1,"Allranges",each Table1)),
#"Expanded Custom1" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Ranges"}, {"Custom.Ranges"}),
#"A"=Table.SelectRows(#"Expanded Custom1", each Text.StartsWith([IP Address], [Custom.Ranges])),
#"Removed Columns" = Table.RemoveColumns(A,{"Custom.Ranges"})
in
#"Removed Columns"
Best Regards,
Angelia
- AM_XRX9 years agoFrequent Visitor
Brilliant, thank you Angelia!