Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Estoy tratando de realizar un poco de ETL en datos que están en 4 hojas de cálculo separadas. Los datos se distribuyen en varias columnas en cada hoja de cálculo.
Lo que estoy intentando hacer es rellenar una nueva tabla en PBI con los datos de las cuatro hojas de cálculo y solo necesito dos puntos de datos específicos de cada columna, los datos a las 2 pm y el valor de datos más alto en cada columna, transponiendo los encabezados de columna a la primera celda de cada fila. Cada mes tendré que agregar filas para los nuevos datos en función de la fecha. Tengo problemas para descubrir cómo recorrer las tablas por columnas para obtener los datos y transponer los encabezados de columna a la primera celda de cada fila junto con la fecha como la segunda celda.
Los datos del origen se estructuran de la siguiente manera:
Tabla de origen
Fecha | Hora | A | B | C | D |
Ago 1 2021 | 13:30 | 111257989.68 | 19167985 | 17636247 | 1132778 |
Ago 1 2021 | 13:35 | 7645951.87 | 34476838 | 19918480 | 219570.6 |
Ago 1 2021 | 13:40 | 10205151.81 | 425121517 | 20544832 | 108048.8 |
Ago 1 2021 | 13:45 | 10905264.99 | 13984556 | 818248380 | 1425266 |
Ago 1 2021 | 13:50 | 9250942.64 | 15478748 | 17109640 | 1027010 |
Ago 1 2021 | 13:55 | 7484875.44 | 22803976 | 18195703 | 151750 |
Ago 1 2021 | 14:00 | 10061118.08 | 22616585 | 19265430 | 88371.39 |
Ago 1 2021 | 14:05 | 12074915.12 | 23823973 | 20644159 | 27561.36 |
Ago 1 2021 | 14:10 | 12776444.37 | 34143440 | 23098988 | 26887.87 |
Necesito poner los datos en una tabla cada mes que se verá así, las primeras 4 filas representan datos históricos prepoblados
Salida requerida
Socio | Fecha | Figura de las 2 PM | Figura máxima |
A | 1 de julio de 2021 | 9454697.07 | 56639853.23 |
B | 1 de julio de 2021 | 67732312.43 | 637518526.8 |
C | 1 de julio de 2021 | 160709030.1 | 986779614.61 |
D | 1 de julio de 2021 | 9157176.91 | 72840928.88 |
A | Ago 1 2021 | 10061118.08 | 111257989.68 |
B | Ago 1 2021 | 22616585 | 425121517 |
C | Ago 1 2021 | 19265430 | 818248380 |
D | Ago 1 2021 | 88371.39 | 1132778 |
Solved! Go to Solution.
Allí, @BarryM;
El método de AlexisOlson es muy bueno. Aquí hay otro método de referencia:
1.Seleccione las columnas (A, B, C, D) y despivotí.
2. Agrupar por fecha y columnas de socio.
3.expandirlo.
4.filter 2:00 PM.
El resultado final se muestra a continuación:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZI7TkNBDEW3EqVGI/8/6WjZQpKaBqXL/rGdIEAa0VC9sXXnzH3XPp+Pr/f3Ax4ICI8vR+QTQ38RST0jl0WXiVaV9tGNjcRHxOQex+vLhtJaN9FUXNFqFnELfuASQ6IfIkx1WLaFyFgBAsWmdFdIkapqYvVFgmlEARJr70XGNyQomazM6WaIqtUxMEievopOtvei7SVJIYWWSTdVPFzmohfevuw6IOwZE4rUr7suaQZRAKe3D4yJgoeMrjuEnODxBlhNKBbEMAxNH8NJMpWZYAQ7Ls49ZcQELom6sBMkDionPLmaCGrnRK5WlF0kcsLxUitQcln8GDJKDXomy1D7E+PQIry3oClv94//hvIb8QwlRcXSF7QPc2dipCV8uV1uLTPwWgGG1ZeiBGkoy3BP/DOgH+P+Duj6CQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, #"Time " = _t, A = _t, B = _t, C = _t, D = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Time ", type time}, {"A", type number}, {"B", type number}, {"C", type number}, {"D", type number}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date", "Time "}, "Partner", "Value"),
#"Grouped Rows" = Table.Group(#"Unpivoted Columns", {"Date", "Partner"}, {{"Max Figure", each List.Max([Value]), type number}, {"all", each _, type table [Date=nullable date, #"Time "=nullable time, Partner=text, Value=number]}}),
#"Expanded all" = Table.ExpandTableColumn(#"Grouped Rows", "all", {"Time ", "Value"}, {"all.Time ", "2PM Figure"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded all", each ([#"all.Time "] = #time(14, 0, 0))),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"all.Time "}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Date", "Partner", "2PM Figure", "Max Figure"})
in
#"Reordered Columns"
Saludos
Apoyo a la comunidad Team_ Yalan Wu
Si esta publicación ayuda,entonces considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.
Allí, @BarryM;
El método de AlexisOlson es muy bueno. Aquí hay otro método de referencia:
1.Seleccione las columnas (A, B, C, D) y despivotí.
2. Agrupar por fecha y columnas de socio.
3.expandirlo.
4.filter 2:00 PM.
El resultado final se muestra a continuación:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZI7TkNBDEW3EqVGI/8/6WjZQpKaBqXL/rGdIEAa0VC9sXXnzH3XPp+Pr/f3Ax4ICI8vR+QTQ38RST0jl0WXiVaV9tGNjcRHxOQex+vLhtJaN9FUXNFqFnELfuASQ6IfIkx1WLaFyFgBAsWmdFdIkapqYvVFgmlEARJr70XGNyQomazM6WaIqtUxMEievopOtvei7SVJIYWWSTdVPFzmohfevuw6IOwZE4rUr7suaQZRAKe3D4yJgoeMrjuEnODxBlhNKBbEMAxNH8NJMpWZYAQ7Ls49ZcQELom6sBMkDionPLmaCGrnRK5WlF0kcsLxUitQcln8GDJKDXomy1D7E+PQIry3oClv94//hvIb8QwlRcXSF7QPc2dipCV8uV1uLTPwWgGG1ZeiBGkoy3BP/DOgH+P+Duj6CQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, #"Time " = _t, A = _t, B = _t, C = _t, D = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Time ", type time}, {"A", type number}, {"B", type number}, {"C", type number}, {"D", type number}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date", "Time "}, "Partner", "Value"),
#"Grouped Rows" = Table.Group(#"Unpivoted Columns", {"Date", "Partner"}, {{"Max Figure", each List.Max([Value]), type number}, {"all", each _, type table [Date=nullable date, #"Time "=nullable time, Partner=text, Value=number]}}),
#"Expanded all" = Table.ExpandTableColumn(#"Grouped Rows", "all", {"Time ", "Value"}, {"all.Time ", "2PM Figure"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded all", each ([#"all.Time "] = #time(14, 0, 0))),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"all.Time "}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Date", "Partner", "2PM Figure", "Max Figure"})
in
#"Reordered Columns"
Saludos
Apoyo a la comunidad Team_ Yalan Wu
Si esta publicación ayuda,entonces considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.
Despivoar las columnas A, B, C, D es el primer paso.
Luego puede hacer un grupo para calcular el máximo y por separado hacer un filtro para obtener solo los valores de 2 PM y luego fusionarlos.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bZI5bkMxDESvYvw6ELgMN3c5QID0huucIPcPKQPJB/I7UsvTaDiPx/H+/XXjm5Dw8XbwXelOdPv8mIZZLCprxXTF3o1NGa4u2KusEpHH8+0/yX5J4bAyXjlXFAhPzc0sTiR1KVwWtPyKhJMmEjIe1GxBjKW7wfY6kCr7UBJyXaqCnVhFJo5VNZ1Wwsy7TE5p1NbF/Yb4pSz7k1ViVJDlmB1DZGB/MPoRB72UBzFdgk5Oof0IWxiQSJJWjCTO7Y9uPIddcKQhp7+R9/xyUW6Qs9trdiVu0FGUqcFL6xJ1skkoUGyLx1vRlNak23EH2MY8CfNGXdgkdz6p6qz0HSx9BYHRYdjTV+qc5dbqmTFJeT5/AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Time = _t, A = _t, B = _t, C = _t, D = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Time", type time}, {"A", type number}, {"B", Int64.Type}, {"C", Int64.Type}, {"D", type number}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date", "Time"}, "Partner", "Value"),
#"Grouped Rows" = Table.Group(#"Unpivoted Columns", {"Partner", "Date"}, {{"Max Figure", each List.Max([Value]), type number}}),
#"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Time] = #time(14, 0, 0))),
#"Merged Queries" = Table.NestedJoin(#"Grouped Rows", {"Date", "Partner"}, #"Filtered Rows", {"Date", "Partner"}, "Filtered Rows", JoinKind.LeftOuter),
#"Expanded Filtered Rows" = Table.ExpandTableColumn(#"Merged Queries", "Filtered Rows", {"Value"}, {"2 PM Figure"}),
#"Reordered Columns" = Table.ReorderColumns(#"Expanded Filtered Rows",{"Partner", "Date", "2 PM Figure", "Max Figure"})
in
#"Reordered Columns"
¡Muchas gracias! Solo para que lo entienda correctamente tengo1 pregunta sobre el código.
¿Puede ampliar lo que está sucediendo en esta parte del código?
(Binary.Decompress(Binary.FromText("bZI5bkMxDESvYvw6ELgMN3c5QID0huucIPcPKQPJB/I7UsvTaDiPx/H+/XXjm5Dw8XbwXelOdPv8mIZZLCprxXTF3o1NGa4u2KusEpHH8+0/yX5J4bAyXjlXFAhPzc0sTiR1KVwWtPyKhJMmEjIe1GxBjKW7wfY6kCr7UBJyXaqCnVhFJo5VNZ1Wwsy7TE5p1NbF/Yb4pSz7k1ViVJDlmB1DZGB/MPoRB72UBzFdgk5Oof0IWxiQSJJWjCTO7Y9uPIddcKQhp7+R9/xyUW6Qs9trdiVu0FGUqcFL6xJ1skkoUGyLx1vRlNak23EH2MY8CfNGXdgkdz6p6qz0HSx9BYHRYdjTV+qc5dbqmTFJeT5/AA==", BinaryEncoding.Base64), Compression.Deflate))
Pegué sus datos en el cuadro Introducir datos. Esa cadena de tonterías aparentes es que los datos en forma comprimida. Eche un vistazo a cualquier consulta iniciada con Enter Data y verá algo similar.
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.