Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hola
Tengo un archivo csv que está semiestructurado. Necesito poder extraer la información que quiero y volver a presentarla de manera tabular. He intentado rellenar a partir del ejemplo y no está funcionando tan bien como quiero.
This is what the source file looks likeAsí es como se ve el archivo de origen
This is what the final output should look likeAsí es como debería verse el resultado final
Quiero convertir el archivo de origen sin encabezados en una tabla que se parezca a la segunda tabla.
He intentado discutirlo con powerquery varias veces, desafortunadamente parece que no puedo descubrir cómo separar las filas superiores de las inferiores y los dos tipos diferentes de estadísticas capturadas. Cualquier ayuda será muy apreciada.
Aquí está el enlace al archivo fuente del archivo fuente
Necesito un tipo de ayuda similar. Necesito poder separar una columna de datos en varias columnas donde aparece un determinado delimitador.
Quiero dividir esta columna en varias columnas por : delimitador. Quiero crear una nueva columna en todas partes: aparece el delimitador. Sé cómo encontrar la posición del delimitador, pero no sé cómo recorrer cada instancia. A continuación se muestra el resultado final que espero lograr.
Muchas gracias por la ayuda en esto. Comencé subconfigurando datos del conjunto de datos original, pero mirando su código, puedo omitir varios de los pasos que estaba haciendo. Este es un enfoque mucho mejor con menos pasos de los que había comenzado. Gracias un millón de veces 🙂
Pruebe este código M:
let
Source = Csv.Document(File.Contents("C:\Users\Admin\Desktop\data.csv"),[Delimiter=",", Columns=9, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", Int64.Type}, {"Column4", Int64.Type}, {"Column5", Int64.Type}, {"Column6", Int64.Type}, {"Column7", Int64.Type}, {"Column8", Int64.Type}, {"Column9", Int64.Type}}),
#"Removed Top Rows" = Table.Skip(#"Changed Type",10),
#"Added Custom" = Table.AddColumn(#"Removed Top Rows", "blank", each null),
#"Transposed Table" = Table.Transpose(#"Added Custom"),
#"Filled Down" = Table.FillDown(#"Transposed Table",{"Column1", "Column9"}),
#"Transposed Table1" = Table.Transpose(#"Filled Down"),
#"Filled Down1" = Table.FillDown(#"Transposed Table1",{"Column10"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down1", each [Column1] <> "" and [Column1] <> "Result Type:"),
#"Promoted Headers" = Table.PromoteHeaders(#"Filtered Rows", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Week", type text}, {"Person", type text}, {"1", Int64.Type}, {"2", Int64.Type}, {"3", Int64.Type}, {"4", Int64.Type}, {"5", Int64.Type}, {"6", Int64.Type}, {"7", Int64.Type}, {"Average", type text}}),
#"Filtered Rows1" = Table.SelectRows(#"Changed Type1", each ([Week] <> "Week")),
#"Renamed Columns" = Table.RenameColumns(#"Filtered Rows1",{{"Average", "Type"}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Renamed Columns", {"Week", "Person", "Type"}, "Attribute", "Value"),
#"Renamed Columns1" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "Day of week"}}),
// date
#"Kept First Rows" = Table.FirstN(#"Changed Type",3),
#"Transposed Table_date" = Table.Transpose(#"Kept First Rows"),
// Time in, Time out, Date
#"Timein" = #"Transposed Table_date"{1}[Column1],
#"Timeout" = #"Transposed Table_date"{1}[Column2],
#"Date" = #"Transposed Table_date"{1}[Column3],
// Add column
#"Added column" = Table.AddColumn(#"Renamed Columns1","Time in", each #"Timein"),
#"Added Custom1" = Table.AddColumn(#"Added column", "Time out", each #"Timeout"),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Date", each #"Date"),
#"Reordered Columns" = Table.ReorderColumns(#"Added Custom2",{"Date", "Time in", "Time out", "Week", "Person", "Type", "Day of week", "Value"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Reordered Columns",{{"Date", type date}, {"Time in", type datetime}, {"Time out", type datetime}})
in
#"Changed Type2"
Resultado:
Pbix al final puedes referirte.
Saludos
Equipo de apoyo a la comunidad _ chenwu zhu
Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.