Table.ColumnsOfType
The names of the columns whose type is one of the types you list.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.ColumnsOfType(table as table, listOfTypes as list) as list
| Parameter | Type | Description |
|---|---|---|
table | table | The table to look at. |
listOfTypes | list | The types to look for, such as {type number} or {type text, type date}. |
Returns
list. The matching columns' names, in the table's order.
Remarks
- It looks at the columns' declared types, not at the values: a column made by
#tablewith names only is of typeanyand matches none of these. Set the types first, withTable.TransformColumnTypesor a table type. - A column matches when its type is of a listed type, nullability included: a nullable number column is found by
{type nullable number}, not by{type number}. Columns typed byTable.TransformColumnTypesare nullable.
Examples
The number columns
let
Lines = #table(type table [Product = text, Price = number, Units = number, Sold = date],
{{"Chair", 50, 4, #date(2026, 3, 2)}})
in
Table.ColumnsOfType(Lines, {type number})
{"Price", "Units"}
Texts and dates
let
Lines = #table(type table [Product = text, Price = number, Units = number, Sold = date],
{{"Chair", 50, 4, #date(2026, 3, 2)}})
in
Table.ColumnsOfType(Lines, {type text, type date})
{"Product", "Sold"}
A nullable column
let
Lines = #table(type table [Price = nullable number, Units = number], {{50, 4}})
in
[Number = Table.ColumnsOfType(Lines, {type number}), Nullable = Table.ColumnsOfType(Lines, {type nullable number})]
[Number = {"Units"}, Nullable = {"Price", "Units"}]
Related functions
Table.ColumnNames, Table.Schema, Table.TransformColumnTypes.