Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
We have a data set coming from csv files which are combined. These files will have new columns whose names will begin with "LOT". How would I go about dynamically transposing these new columns as they come in?
I manually transposed one, but I'm not sure how to do that for future ones...
let
Fonte = Folder.Files("Path"),
#"Arquivos Ocultos Filtrados1" = Table.SelectRows(Fonte, each [Attributes]?[Hidden]? <> true),
#"Invocar Função Personalizada1" = Table.AddColumn(#"Arquivos Ocultos Filtrados1", "Transformar Arquivo", each #"Transformar Arquivo"([Content])),
#"Colunas Renomeadas1" = Table.RenameColumns(#"Invocar Função Personalizada1", {"Name", "Nome da Origem"}),
#"Outras Colunas Removidas1" = Table.SelectColumns(#"Colunas Renomeadas1", {"Nome da Origem", "Transformar Arquivo"}),
#"Coluna de Tabela Expandida1" = Table.ExpandTableColumn(#"Outras Colunas Removidas1", "Transformar Arquivo", Table.ColumnNames(#"Transformar Arquivo"(#"Arquivo de Amostra"))),
#"Tipo Alterado" = Table.TransformColumnTypes(#"Coluna de Tabela Expandida1",{{"Nome da Origem", type text}, {"IDADE_SEM", Int64.Type}, {"VIAB_TAB", Int64.Type}, {"LOTE_163", Int64.Type}, {"MEDIA", Int64.Type}}),
#"Linhas Filtradas" = Table.SelectRows(#"Tipo Alterado", each Text.EndsWith([Nome da Origem], ".csv")),
#"Somente as Colunas Selecionadas Foram Transformadas em Linhas" = Table.Unpivot(#"Linhas Filtradas", {"LOTE_163"}, "Atributo", "Valor")
in
#"Somente as Colunas Selecionadas Foram Transformadas em Linhas"
Thank you!
Solved! Go to Solution.
@pa2021 You do that by doing the unpivot the other way round - "Unpivot other columns"
@pa2021 You do that by doing the unpivot the other way round - "Unpivot other columns"
It worked, but I had to tweak it so as to allow for dynamic columns that will be added to the table down the road.
Thank you!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
97 | |
80 | |
69 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |