Partilhar via


Table.IsDistinct

Sintaxe

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

Sobre

Indica se o table contém apenas linhas distintas (sem duplicatas). Retorna true se as linhas forem distintas, false caso contrário. Um parâmetro opcional, comparisonCriteria, especifica quais colunas da tabela são testadas para duplicação. Se comparisonCriteria não for especificado, todas as colunas serão testadas.

Exemplo 1

Verifique se a tabela é distinta.

Utilização

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

Saída

true

Exemplo 2

Determine se a tabela tem colunas distintas.

Utilização

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

Saída

false

Critérios de comparação