OpenBI Docs Buy

Table.HasColumns

Tells whether a table has a column, or every column of a list.

Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Table.HasColumns(table as table, columns as any) as logical
ParameterTypeDescription
tabletableThe table to look at.
columnsanyA column name, or a list of names.

Returns

logical. true when every name is one of the table's columns.

Remarks

  • Names are compared exactly: "price" is not the column "Price".

Examples

One column

Table.HasColumns(#table({"Product", "Price", "Units"}, {{"Chair", 50, 4}, {"Desk", 120, 1}, {"Lamp", 30, 6}}), "Price")
true

All of a list

Table.HasColumns(#table({"Product", "Price", "Units"}, {{"Chair", 50, 4}, {"Desk", 120, 1}, {"Lamp", 30, 6}}), {"Price", "Discount"})
false

Table.ColumnNames, Table.ColumnCount, Record.HasFields.

Last updated · OpenBI Studio 0.3.79