List.RemoveItems
ListRemoves all occurrences of specified values from a list.
Syntax
List.RemoveItems(list1 as list, list2 as list) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list1 | list | Yes | The original list. |
list2 | list | Yes | A list of values to remove from the first list. |
Return Value
list — A list with all occurrences of the specified values removed.
Remarks
List.RemoveItems removes all occurrences of specific values from a list. A common pattern is combining Table.ColumnNames with List.RemoveItems to get all column names except certain ones, then passing the result to Table.SelectColumns or Table.UnpivotOtherColumns.
Examples
Example 1: Get columns except specific ones
let
AllCols = Table.ColumnNames(Sales),
Excluded = List.RemoveItems(AllCols, {"OrderDate", "Region"})
in
#table({"ColumnName"}, List.Transform(Excluded, each {_}))Result
ColumnName | |
|---|---|
| 1 | OrderID |
| 2 | CustomerName |
| 3 | Product |
| 4 | Category |
| 5 | UnitPrice |
| 6 | Quantity |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks