Table.ColumnsOfType

Table.ColumnsOfType is a Power Query M function that returns a list with the names of the columns from the input table that match the specified types. The function returns a list of column names with matching types.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Table.ColumnsOfType(
   table as table,
   listOfTypes as list,
) as list

Description

Returns a list with the names of the columns from table table that match the types specified in listOfTypes.

Examples

Return the names of columns of type Number.Type from the table.

// Output: {"a"}
Table.ColumnsOfType( 
    Table.FromRecords( 
        {[a = 1, b = "hello"]},
        type table[a = Number.Type, b = Text.Type]
     ),
    {type number}
 )

Other functions related to Table.ColumnsOfType are:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-columnsoftype
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.