Table.IsDistinct

Sintassi

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

Informazioni su

Indica se table contiene solo le righe distinte (nessun duplicato). Restituisce true se le righe sono distinte; in caso contrario, false. Il parametro comparisonCriteria facoltativo specifica le colonne della tabella da testare per la duplicazione. Se comparisonCriteria non viene specificato, verranno testate tutte le colonne.

Esempio 1

Determinare se la tabella è distinta.

Utilizzo

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"]
    })
)

Output

true

Esempio 2

Determinare se la tabella ha valori unici nella colonna.

Utilizzo

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"
)

Output

false

Criteri di confronto