Table.FirstValue
The value in the first column of a table's first row.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.FirstValue(table as table, optional default as any) as any
| Parameter | Type | Description |
|---|---|---|
table | table | The table to read. |
default | any optional | What comes back when the table has no rows; null when left out. |
Returns
any. The top left value; the default when the table is empty.
Remarks
- Handy for a query that gives one value, such as a total or a setting read from a sheet.
Examples
A one-cell table
Table.FirstValue(#table({"Total"}, {{540}}))
540
A wider table: the top left cell
Table.FirstValue(#table({"Product", "Price", "Units"}, {{"Chair", 50, 4}, {"Desk", 120, 1}, {"Lamp", 30, 6}}))
"Chair"
Empty, with a default
Table.FirstValue(#table({"Total"}, {}), 0)
0