List.MinN
ListReturns the N smallest values from a list, or values meeting a condition, in ascending order.
Syntax
List.MinN(list as list, countOrCondition as any, optional comparisonCriteria as any) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to search. |
countOrCondition | any | Yes | A number specifying how many minimum values to return, or a condition function. |
comparisonCriteria | any | No | An optional comparison criteria or comparer function to control ordering. |
Return Value
list — A list of the N smallest values, sorted in ascending order.
Remarks
List.MinN returns the bottom N values from a list as a list sorted in ascending order. It is the multi-value counterpart of List.Min, which returns a single scalar.
When passed a number N, it returns the N smallest values from the list. If N exceeds the list length, the entire list is returned sorted ascending. Null values are ignored. Duplicates are preserved — if the Nth-smallest value appears multiple times, all occurrences are included.
When passed a condition function, the list is first sorted ascending and the condition is applied to each item in that order; items are collected while the condition returns true. This is useful for "give me all values below a threshold" scenarios.
For the single lowest value, use List.Min. To get the highest values instead, use List.MaxN. To sort and slice a full list, combining List.Sort and List.FirstN is an equivalent and readable alternative.
Examples
Example 2: Return values while they are below a threshold
List.MinN({10, 20, 30, 40, 50}, each _ <= 30)Result | |
|---|---|
| 1 | {10, 20, 30} |
Example 3: Find the 3 lowest-cost items
let
Costs = {1200, 850, 3400, 450, 2100, 975},
BottomThree = List.MinN(Costs, 3)
in
BottomThreeThe final output — returns the 3 smallest cost values from the list, sorted in ascending order.
Result | |
|---|---|
| 1 | 450 |
| 2 | 850 |
| 3 | 975 |