Table.Min

Table

Returns the row with the minimum value according to the given comparison criteria.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.Min(table as table, comparisonCriteria as any, optional default as nullable any) as any

Parameters

NameTypeRequiredDescription
tabletableYesThe table to search.
comparisonCriteriaanyYesA column name (text), a list of column names, or a comparer function to determine ordering.
defaultanyNoOptional value to return if the table is empty. Defaults to null.

Return Value

anyThe row with the lowest value as a record, or the default if the table is empty.

Remarks

Table.Min returns the entire row (as a record) that contains the minimum value for the given comparison criteria. If multiple rows share the minimum value, the first one encountered is returned. Access individual fields from the result with record field syntax: Table.Min(t, "OrderDate")[CustomerName].

Table.Min is the counterpart of Table.Max. It is useful when you need the full row context for the minimum — for example, finding the cheapest product's name and category, or the earliest order's customer information. If you only need the minimum scalar value, chain field access directly: Table.Min(t, "Price")[Price].

If the table is empty, Table.Min returns null by default, or the specified default value. Always provide a default when the table may be empty to prevent null-propagation errors in dependent steps.

Examples

Example 1: Find the lowest-priced product

let
    Products = #table(
        type table [ProductID = number, ProductName = text, Category = text, Price = number, InStock = logical],
        {{1,"Widget A","Widgets",25.00,true},{2,"Gadget B","Gadgets",50.00,true},
         {3,"Widget C","Widgets",15.00,false},{4,"Gadget D","Gadgets",75.00,true},{5,"Thingamajig E","Misc",120.00,false}}
    )
in
    Table.Min(Products, "Price")
Result
Result
1[ProductID = 3, ProductName = "Widget C", Category = "Widgets", Price = 15, InStock = false]

Example 2: Extract the earliest order date as a scalar

let
    Sales = #table(
        {"OrderID", "CustomerName", "Product", "OrderDate"},
        {{1,"Alice","Widget A",#date(2024,1,15)},{2,"Bob","Gadget B",#date(2024,1,18)},
         {3,"Charlie","Widget C",#date(2024,2,1)},{8,"Diana","Widget C",#date(2024,4,15)}}
    )
in
    Table.Min(Sales, "OrderDate")[OrderDate]
Result
Result
11/15/2024

Example 3: Return a safe default when the filtered table is empty

let
    Sales = #table(
        {"OrderID", "CustomerName", "Region", "UnitPrice"},
        {{1,"Alice","East",25.00},{3,"Charlie","East",15.00}}
    ),
    WestSales = Table.SelectRows(Sales, each [Region] = "West")
in
    Table.Min(WestSales, "UnitPrice", [OrderID = 0, CustomerName = "N/A", Region = "West", UnitPrice = 0])
Result
Result
1[OrderID = 0, CustomerName = "N/A", Region = "West", UnitPrice = 0]

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks