Forum Discussion
Anonymous
5 years agoNot applicable
Remove lines based on character limit
Hi!
I need to remove lines from my data that has less than 9 characters on it. How can I do it?
Thanks!
Hi Anonymous ,
Please refer to my sample.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSoQDpVgdJC6MB6GhPFQlUHWxAA==", 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}}), #"Removed length less than 9" = Table.SelectRows( #"Changed Type", each not List.IsEmpty( List.RemoveMatchingItems( {Text.Length([Column1])}, {0..8} ) ) ) in #"Removed length less than 9"Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- Greg_DecklerCommunity Champion
Anonymous Add a new column in Power Query and use Text.Length([Column]). Then you can filter based on that column and then remove the column.
- v-lionel-msftCommunity Support
Hi Anonymous ,
Please refer to my sample.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSoQDpVgdJC6MB6GhPFQlUHWxAA==", 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}}), #"Removed length less than 9" = Table.SelectRows( #"Changed Type", each not List.IsEmpty( List.RemoveMatchingItems( {Text.Length([Column1])}, {0..8} ) ) ) in #"Removed length less than 9"Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.