OpenBI Docs Buy

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
ParameterTypeDescription
tabletableThe table with the column.
columntextThe column's name.

Returns

list. The column's values in the rows' order.

Remarks

  • Table[Price] is the same as Table.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]

Table.ToColumns, Table.ColumnNames, Table.SelectColumns, List.Sum.

Last updated · OpenBI Studio 0.3.79