Table.IsDistinct

Updated on

Table.IsDistinct is a Power Query M function that indicates whether a table contains only distinct rows (no duplicates). The function returns true if the rows are distinct, and false otherwise.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Table.IsDistinct(
   table as table,
   optional comparisonCriteria as any,
) as logical

Description

Table.IsDistinct indicates whether the table contains only distinct rows. It returns true if rows in table are distinct, false otherwise. An optional comparisonCriteria can specify test columns.

Examples

Determine if the table is distinct.

// Output: true
Table.IsDistinct( 
    Table.FromRecords( {
        [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
        [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
        [CustomerID = 3, Name = "Paul", Phone = "543-7890"],
        [CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
    } )
 )

Determine if the table is distinct in column.

// Output: false
Table.IsDistinct( 
    Table.FromRecords( {
        [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
        [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
        [CustomerID = 3, Name = "Paul", Phone = "543-7890"],
        [CustomerID = 5, Name = "Bob", Phone = "232-1550"]
    } ),
    "Name"
 )

Other functions related to Table.IsDistinct are:

BI Gorilla Blog

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-isdistinct