https://github.com/alisonpezzott/youtube-20240918-texto-para-linhas
https://github.com/alisonpezzott/youtube-20240918-texto-para-linhas
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alisonpezzott/youtube-20240918-texto-para-linhas
- Owner: alisonpezzott
- Created: 2024-09-13T20:04:48.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-25T00:16:52.000Z (9 months ago)
- Last Synced: 2025-02-07T22:25:12.533Z (4 months ago)
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Entrada
| a | b | c |
|-----|-----|-----|
| 124/456/789 | ABC/DEF/GHI | JKL/MNO/PQR |## Tratamento - Power Query M
```pq
let
// Cria a tabela inicial com os valores concatenados em cada coluna
tabelaInicial = Table.FromRecords({[
a = "124/456/789",
b = "ABC/DEF/GHI",
c = "JKL/MNO/PQR"
]}),// Transpõe toda a tabela e transforma em uma lista
tabelaTransposta = Table.Transpose(tabelaInicial)[Column1],// Divide cada item da lista pelo separador
textoDividido = List.Transform(tabelaTransposta, (linhaAtual) => Text.Split(linhaAtual, "/")),
// Transforma as listas em colunas da tabela
paraTabela = Table.FromColumns(textoDividido, Table.ColumnNames(tabelaInicial)),
// Altera o tipo de dados
tipoAlterado = Table.TransformColumnTypes(paraTabela,{{"a", Int64.Type}, {"b", type text}, {"c", type text}})
in
tipoAlterado
```## Saída
| a | b | c |
|-----|-----|-----|
| 124 | ABC | JKL |
| 456 | DEF | MNO |
| 789 | GHI | PQR |