Table.Column
A column's values, top to bottom, as a list.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.Column(table as table, column as text) as list
| Parameter | Type | Description |
|---|---|---|
table | table | The table with the column. |
column | text | The column's name. |
Returns
list. The column's values in the rows' order.
Remarks
Table[Price]is the same asTable.Column(Table, "Price").- A name that is not one of the table's columns is an error.
Examples
The prices
Table.Column(#table({"Product", "Price", "Units"}, {{"Chair", 50, 4}, {"Desk", 120, 1}, {"Lamp", 30, 6}}), "Price")
{50, 120, 30}
Sum of a column
List.Sum(Table.Column(#table({"Product", "Price", "Units"}, {{"Chair", 50, 4}, {"Desk", 120, 1}, {"Lamp", 30, 6}}), "Units"))
11
A column that isn't there
Table.Column(#table({"Product", "Price", "Units"}, {{"Chair", 50, 4}, {"Desk", 120, 1}, {"Lamp", 30, 6}}), "Cost")
Result: an error.
[Reason = "Expression.Error", Message = "The column 'Cost' of the table wasn't found.", Detail = null]
Related functions
Table.ToColumns, Table.ColumnNames, Table.SelectColumns, List.Sum.