Forum Discussion
Syndicate_Admin
Administrator
3 years agoPQ/M working with list syntax - List.RemoveItems with criteria
Hi all, Using PQ to transform text data where a particular column can contain excessive characters (over the 32k mark). The column in question is a dump of activity logging. There is a patter...
collinsg
Solution Sage
3 years agoGood day steve-m
The function List.RemoveMatchingItems may help solve this.
- I created a table in Excel with a column called "Activity". It contained some items starting with "Rev" and others not starting with "Rev". The table was called "Table1".
- The first parameter of List.RemoveMatchingItems is a list - in this example the "Activity" column.
- The second parameter is a list of items you want to remove...
- ...the third parameter of the example says - keep each item not beginning with "Rev".
Here is the M code.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Remove Rev Rows" = List.RemoveMatchingItems(
Source[Activity],
{"Rev"},
each Text.Start(_,3) <> "Rev"
)
in
#"Remove Rev Rows"
Here are the results of the "Source" step and the "Remove Rev Rows" step.