🔧 Transformar e Limpar Dados com Power Query

🔧 Transform and Clean Data with Power Query

Este módulo aborda a etapa de transformação, fundamental para garantir qualidade, consistência e estrutura do dataset.

This module covers the transformation step, essential to ensure quality, consistency, and structure of the dataset.


🔹 Categorias de Transformações

🔹 Categories of Transformations

✔ Estrutura

✔ Structure

  • Remover linhas
  • Remove rows
  • Remover colunas
  • Remove columns
  • Dividir colunas
  • Split columns
  • Transpor dados
  • Transpose data
  • Agrupar por
  • Group by

✔ Qualidade

✔ Quality

  • Remover duplicatas
  • Remove duplicates
  • Detectar e corrigir erros
  • Detect and fix errors
  • Substituir valores
  • Replace values
  • Preencher valores
  • Fill values

✔ Tipos de dados

✔ Data types

  • Conversão para inteiro, decimal, data, texto
  • Conversion to integer, decimal, date, text
  • Detecção automática x manual
  • Automatic vs manual detection

🔹 Ferramentas importantes

🔹 Important Tools

Column Profile

Column Profile

Exibe estatísticas detalhadas: - Valores distintos
- Valores vazios
- Mínimo/máximo
- Distribuição

Displays detailed statistics: - Distinct values
- Empty values
- Minimum/maximum
- Distribution

Column Quality

Column Quality

Mostra: - Porcentagem válida
- Erros
- Valores vazios

Shows: - Valid percentage
- Errors
- Empty values

Column Distribution

Column Distribution

Histograma por coluna

Histogram per column


🔹 Mesclar Tabelas (JOIN)

🔹 Merge Tables (JOIN)

Power Query suporta:

Power Query supports:

  • Left Outer (mais comum)
  • Left Outer (most common)
  • Right Outer
  • Right Outer
  • Inner
  • Inner
  • Full Outer
  • Full Outer
  • Anti Joins
  • Anti Joins

Aplicações típicas: - Unir tabelas fato e dimensão
- Acrescentar parâmetros externos
- Substituir VLOOKUP do Excel

Typical applications: - Join fact and dimension tables
- Add external parameters
- Replace Excel VLOOKUP


🔹 Anexar Tabelas (APPEND)

🔹 Append Tables (APPEND)

Usado para empilhar tabelas com mesma estrutura, como:

Used to stack tables with the same structure, such as:

  • Múltiplos arquivos CSV de meses diferentes
  • Multiple CSV files from different months
  • Logs diários
  • Daily logs
  • Exportações de sistemas
  • System exports

🔹 Query Folding

🔹 Query Folding

Folding é quando o Power Query empurra transformações para a fonte de dados.

Folding is when Power Query pushes transformations to the data source.

Transformações que geralmente mantêm folding:

Transformations that usually preserve folding:

  • Filtrar linhas
  • Filter rows
  • Selecionar colunas
  • Select columns
  • Agrupar
  • Group
  • Join
  • Join
  • Alterar tipos
  • Change types

Transformações que quebram folding:

Transformations that break folding:

  • Colunas personalizadas complexas
  • Complex custom columns
  • Passos que exigem processamento local
  • Steps requiring local processing

📚 Links Oficiais

📚 Official Links

  • Power Query transformations:
    https://learn.microsoft.com/power-query/transformation-section
  • Power Query transformations:
    https://learn.microsoft.com/power-query/transformation-section