Pular para o conteúdo
officetuning.aiofficetuning.ai
TreinamentosConsultoriaBibliotecaFerramentasConteúdoPortfólio
Entrar
officetuning.aiofficetuning.ai

Treinamento, consultoria e mentoria para decidir, construir e aprender nas quatro frentes da marca.

AI · Data · Productivity · Dev · São Paulo
contato@officetuning.ai
TreinamentosPower BIExcelSQLPowerPointIA + ProdutividadeTodos os treinamentos
PortalConsultoriaBibliotecaPortfólioBackground BuilderDashboard CanvasConteúdo
InstitucionalPolítica de privacidadeInformações legais
© 2026 officetuning.ai · São Paulo
  1. Biblioteca
  2. Power Query (M)
  3. Funções M
  4. Table.Join

Table.Join

MTabela

Une as linhas de table1 às linhas de table2 com base na igualdade dos valores das colunas-chave selecionadas por key1 (para table1) e key2 (para table2). Por padrão é feita uma junção interna; joinKind permite escolher outro tipo.

Sintaxe

M
Table.Join(table1 as table, key1 as any, table2 as table, key2 as any, optional joinKind as nullable number, optional joinAlgorithm as nullable number, optional keyEqualityComparers as nullable list) as table

Parâmetros

table1tableObrigatório

Tabela à esquerda da junção.

M
Table.FromRecords({...})
key1anyObrigatório

Coluna(s)-chave de table1.

M
"CustomerID"
table2tableObrigatório

Tabela à direita da junção.

M
Table.FromRecords({...})
key2anyObrigatório

Coluna(s)-chave de table2.

M
"CustomerID"
joinKindnullable numberOpcional

Tipo de junção (padrão JoinKind.Inner).

joinAlgorithmnullable numberOpcional

Algoritmo de junção a utilizar.

keyEqualityComparersnullable listOpcional

Comparadores das colunas-chave (uso interno).

Retorna

table

Exemplo

M
Table.Join(
    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"]
    }),
    "CustomerID",
    Table.FromRecords({
        [OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0],
        [OrderID = 2, CustomerID = 1, Item = "1 lb. worms", Price = 5.0],
        [OrderID = 3, CustomerID = 2, Item = "Fishing net", Price = 25.0],
        [OrderID = 4, CustomerID = 3, Item = "Fish tazer", Price = 200.0],
        [OrderID = 5, CustomerID = 3, Item = "Bandaids", Price = 2.0],
        [OrderID = 6, CustomerID = 1, Item = "Tackle box", Price = 20.0],
        [OrderID = 7, CustomerID = 5, Item = "Bait", Price = 3.25]
    }),
    "CustomerID"
)

Resultado

M
Table.FromRecords({
    [CustomerID = 1, Name = "Bob", Phone = "123-4567", OrderID = 1, Item = "Fishing rod", Price = 100],
    [CustomerID = 1, Name = "Bob", Phone = "123-4567", OrderID = 2, Item = "1 lb. worms", Price = 5],
    [CustomerID = 2, Name = "Jim", Phone = "987-6543", OrderID = 3, Item = "Fishing net", Price = 25],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890", OrderID = 4, Item = "Fish tazer", Price = 200],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890", OrderID = 5, Item = "Bandaids", Price = 2],
    [CustomerID = 1, Name = "Bob", Phone = "123-4567", OrderID = 6, Item = "Tackle box", Price = 20]
})

Observações

joinKind: JoinKind.Inner (padrão), LeftOuter, RightOuter, FullOuter, LeftAnti, RightAnti, LeftSemi ou RightSemi. keyEqualityComparers define como comparar as colunas-chave, mas atualmente é destinado apenas a uso interno.

Mais informações

Subgrupo
Table
Referência
https://learn.microsoft.com/pt-br/powerquery-m/table-join
Função anteriorTable.IsEmptyPróxima função Table.Keys
Biblioteca