Forum Discussion
PowerBeeEye
6 years agoMicrosoft Employee
Remove top rows using wildcard
I am able to use the following query to remove rows from the top until we hit a row where the value of Column1 = Name = Table.Skip(Source,each [Data.Column1] <> "Name") How can I do the same ...
- 6 years ago
Hi PowerBeeEye ,
I create an example and do a test of jhartranft60 's solution. It works.
Column1 Column2 Name 1 Name1 2 Name2 3 Name 4 Na1 5 Nam2 6 Nam 7 Name 8 Attach the complete code:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kvMTVXSUTJUitWBcAyBPCM4zwjIM4bzgBwTKAekzBQmAVJlBuMA2ebIOiyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column2", Int64.Type}}), #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1], "Nam") then 1 else 0), #"TableSkip" = Table.Skip(#"Added Conditional Column",each [Custom] <> 0) in #"TableSkip"Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Icey
6 years agoCommunity Support
Hi PowerBeeEye ,
I create an example and do a test of jhartranft60 's solution. It works.
| Column1 | Column2 |
| Name | 1 |
| Name1 | 2 |
| Name2 | 3 |
| Name | 4 |
| Na1 | 5 |
| Nam2 | 6 |
| Nam | 7 |
| Name | 8 |
Attach the complete code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kvMTVXSUTJUitWBcAyBPCM4zwjIM4bzgBwTKAekzBQmAVJlBuMA2ebIOiyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column2", Int64.Type}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1], "Nam") then 1 else 0),
#"TableSkip" = Table.Skip(#"Added Conditional Column",each [Custom] <> 0)
in
#"TableSkip"
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.