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
| Parameter | Type | Description |
|---|---|---|
table | table | The table to look at. |
columns | any | A 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