OpenBI Docs Buy

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
ParameterTypeDescription
tabletableThe table to look at.
listOfTypeslistThe 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 #table with names only is of type any and matches none of these. Set the types first, with Table.TransformColumnTypes or 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 by Table.TransformColumnTypes are 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"}]

Table.ColumnNames, Table.Schema, Table.TransformColumnTypes.

Last updated · OpenBI Studio 0.3.79