List.Mode is a Power Query M function that returns the item that appears most frequently in a list. The function returns the last item if multiple items appear with the same maximum frequency or throws an exception if the list is empty.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
List.Mode(
list as list,
optional equationCriteria as any,
) as any
Argument | Attribute | Description |
---|---|---|
list | The list of values to extract the most frequent value from. | |
equationCriteria | optional | Uses Comparer Functions to determine how values are equated during operations. Options include Comparer.Ordinal for exact case-sensitive matching, Comparer.OrdinalIgnoreCase for case-insensitive matching, and Comparer.FromCulture for culture-specific comparisons. |
Description
Returns the item that appears most frequently in the list, list
. If the list is empty an exception is thrown. If multiple items appear with the same maximum frequency, the last one is chosen.
An optional comparisonCriteria
value, equationCriteria
, can be specified to control equality testing.
Examples
Find the item that appears most frequently in the list {"A", 1, 2, 3, 3, 4, 5}
.
// Output: 3
List.Mode( {"A", 1, 2, 3, 3, 4, 5} )
Find the item that appears most frequently in the list {"A", 1, 2, 3, 3, 4, 5, 5}
.
// Output: 5
List.Mode( {"A", 1, 2, 3, 3, 4, 5, 5} )
Related articles
Learn more about List.Mode in the following articles:
- Lists in Power Query M / List Functions (200+ Examples)
The complete guide to Lists in Power Query M. Learn from practical examples and master Power Query’s most powerful List functions. » Read more
Related functions
Other functions related to List.Mode are:
- List.Average
- List.Count
- List.Covariance
- List.Median
- List.Modes
- List.NonNullCount
- List.Percentile
- List.Product
- List.StandardDeviation
- List.Sum
