Table.IsDistinct Function in Power Query

The Table.IsDistinct indicates whether the table contains only distinct rows (no duplicates). Returns true if the rows are distinct, false otherwise. An optional parameter, comparisonCriteria, specifies which columns of the table are tested for duplication. If comparisonCriteria is not specified, all columns are tested.

Syntax

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

Example: Determine if the table is distinct.

Power Query M

let
  MyTable = Table.FromRecords(
    {
      [CustomerID = 1, Name = "Ashish", Phone = "123-4567"], 
      [CustomerID = 2, Name = "Katrina", Phone = "987-6543"], 
      [CustomerID = 3, Name = "Alia", Phone = "543-7890"], 
      [CustomerID = 4, Name = "Vicky", Phone = "676-8479"], 
      [CustomerID = 5, Name = "Mohini", Phone = "574-8864"], 
      [CustomerID = 6, Name = "Meenakshi", Phone = "574-8864"], 
      [CustomerID = 7, Name = "Esha", Phone = "574-8864"], 
      [CustomerID = 8, Name = "Anjali", Phone = "574-8864"]
    }
  ),
    #"Duplicate Check" = Table.IsDistinct(MyTable)
// If the name contains space put it in quotes and place # in front of it. Otherwise quotes and # is not placed.
in
    #"Duplicate Check"

In the output the above function returns True as we can see in the following image also:

Table.IsDistinct function in Power Query

Example: Determine if the table is distinct in column.

Power Query M

let
  MyTable = Table.FromRecords(
    {
      [CustomerID = 1, Name = "Ashish", Phone = "123-4567"], 
      [CustomerID = 2, Name = "Katrina", Phone = "987-6543"], 
      [CustomerID = 3, Name = "Alia", Phone = "543-7890"], 
      [CustomerID = 4, Name = "Vicky", Phone = "676-8479"], 
      [CustomerID = 5, Name = "Mohini", Phone = "574-8864"], 
      [CustomerID = 6, Name = "Meenakshi", Phone = "574-8864"], 
      [CustomerID = 7, Name = "Esha", Phone = "574-8864"], 
      [CustomerID = 8, Name = "Anjali", Phone = "574-8864"]
    }
  ),
    #"Duplicate Check" = Table.IsDistinct(MyTable, "Phone")
// If the name contains space put it in quotes and place # in front of it. Otherwise quotes and # is not placed.
in
    #"Duplicate Check" 

In the output the above function returns false as we can see in the following image also:

Table.IsDistinct function in Power Query