List.IsDistinct
ListReturns true if the list contains no duplicate values.
Syntax
List.IsDistinct(list as list, optional equationCriteria as any) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to check for uniqueness. |
equationCriteria | any | No | An optional equation criteria to control how equality is determined. |
Return Value
logical — True if all values in the list are unique; false if any duplicates exist.
Remarks
List.IsDistinct checks whether every item in a list is unique. It returns true if all items are distinct, and false if any value appears more than once. This is a convenient data quality check — for example, verifying that a key column has no duplicate values before using it in a merge.
An empty list returns true (vacuous truth: no duplicates can exist). Null values are treated as equal to each other, so a list containing two or more nulls is not distinct. Comparison is case-sensitive for text by default; pass Comparer.OrdinalIgnoreCase for case-insensitive uniqueness checking.
List.IsDistinct is equivalent to List.Count(list) = List.Count(List.Distinct(list)) but expresses intent more clearly. When you need to validate uniqueness for a table column, pass the column as a list: List.IsDistinct(Table[ColumnName]).
Examples
Example 1: All values are distinct
List.IsDistinct({1, 2, 3, 4, 5})Result | |
|---|---|
| 1 | TRUE |
Example 2: Duplicate values present
List.IsDistinct({1, 2, 3, 2, 5})Result | |
|---|---|
| 1 | FALSE |
Example 3: Case-insensitive check
List.IsDistinct({"Apple", "apple", "Banana"}, Comparer.OrdinalIgnoreCase)Result | |
|---|---|
| 1 | FALSE |
Example 4: Validate a key column has no duplicates
let
Keys = {"ID-001", "ID-002", "ID-003", "ID-004"},
IsUnique = List.IsDistinct(Keys)
in
IsUniqueResult | |
|---|---|
| 1 | TRUE |