Table.Min is a Power Query M function that identifies the smallest row in a table based on comparison criteria. The function returns the smallest row, or an optional default value if the table is empty.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Table.Min(
table as table,
comparisonCriteria as any,
optional default as any,
) as any
Description
Table.Min returns the smallest row or a default value using the given criteria. It selects the smallest row in table
based on comparisonCriteria
or returns default
if empty.
Examples
Find the row with the smallest value in column [a] in the table.
// Output: [a = 2, b = 4]
Table.Min(
Table.FromRecords( {
[a = 2, b = 4],
[a = 6, b = 8]
} ),
"a"
)
Find the row with the smallest value in column [a] in the table. Return -1 if empty.
// Output: -1
Table.Min( #table( {"a"}, {} ), "a", -1 )
Related functions
Other functions related to Table.Min are:
- Table.AggregateTableColumn
- Table.First
- Table.FirstN
- Table.FirstValue
- Table.Last
- Table.LastN
- Table.Max
- Table.MaxN
- Table.MinN
- Table.SingleRow
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy