List.FirstN
This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.
Returns the first set of items in the list by specifying how many items to return or a qualifying condition provided by countOrCondition.
List.FirstN(list as list, countOrCondition as any) as any
| Argument | Description |
|---|---|
| list | The List to check. |
| countOrCondition | The number or condition to qualify against. |
If a number is specified, up to that many items are returned.
If a condition is specified as a function, all items are returned that initially meet the condition.
Once an item fails the condition, no further items are considered.
List.FirstN({3, 4, 5, -1, 7, 8, 2}, 2) equals {3, 4}
List.FirstN({3, 4, 5, -1 ,7, 8, 2}, each_ > 2) equals {3, 4, 5}
Show: