Table.IsDistinct
Tells whether a table has no duplicate rows, either whole or by the columns you name.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.IsDistinct(table as table, optional comparisonCriteria as any) as logical
| Parameter | Type | Description |
|---|---|---|
table | table | The table to check. |
comparisonCriteria | any optional | The columns that must not repeat, as a name or a list of names; every column when left out. |
Returns
logical. true when no two rows are the same by the criteria.
Remarks
- A quick check before a column is used as a key, for example on a product table before it is related to sales.
Examples
Every row different
Table.IsDistinct(#table({"Shop", "Product", "Units"}, {{"Oslo", "Chair", 4}, {"Bergen", "Desk", 1}, {"Oslo", "Lamp", 6}, {"Bergen", "Chair", 2}}))
true
Is Product a key?
Table.IsDistinct(#table({"Shop", "Product", "Units"}, {{"Oslo", "Chair", 4}, {"Bergen", "Desk", 1}, {"Oslo", "Lamp", 6}, {"Bergen", "Chair", 2}}), {"Product"})
false
Chair appears twice: the answer is false.