Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Tengo un departamento al que le gusta mucho pronosticar en formato tabular, pero dividen las cantidades mensuales en dos grupos de columnas:
Orgánico | Promoción | ||||||||||||||||||||||||
País | Artículo | Ene | Feb | Estropear | Apr | Mayo | Jun | Jul | Ago | Sep | Oct | Nov | Dic | Ene | Feb | Estropear | Apr | Mayo | Jun | Jul | Ago | Sep | Oct | Nov | Dic |
NOS | OBJETO DE PRUEBA | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 150 | 200 | 300 | 200 | 0 | 0 | 0 | 50 | 0 | 0 | 100 | 0 | 0 | 0 | 200 | 0 |
Y estoy buscando una manera de anular la dinamización de estos datos para que tenga este resultado:
País | Artículo | Orgánico | Promoción |
NOS | OBJETO DE PRUEBA | 100 | 0 |
NOS | OBJETO DE PRUEBA | 100 | 0 |
NOS | OBJETO DE PRUEBA | 100 | 0 |
NOS | OBJETO DE PRUEBA | 100 | 50 |
NOS | OBJETO DE PRUEBA | 100 | 0 |
NOS | OBJETO DE PRUEBA | 100 | 0 |
NOS | OBJETO DE PRUEBA | 100 | 100 |
NOS | OBJETO DE PRUEBA | 100 | 0 |
NOS | OBJETO DE PRUEBA | 150 | 0 |
NOS | OBJETO DE PRUEBA | 200 | 0 |
NOS | OBJETO DE PRUEBA | 300 | 200 |
NOS | OBJETO DE PRUEBA | 200 | 0 |
Parece que solo puedo despivotar esto en 24 filas, en lugar de 12 filas y 2 columnas de valores.
Solved! Go to Solution.
Gracias a ambos, @Ashish_Mathur y @lbendlin. Por confidencialidad, mantuve mis datos vagos, pero sus comentarios me indicaron la dirección correcta.
Para ayudar a otros, aquí está la explicación general de lo que hice:
En general, lo que quieres es anular la pivotación y luego volver a pivotar. La clave es colocar los encabezados pivotantes resultantes deseados en una sola columna de "Encabezados pivote". Entonces, si desea terminar con 4 grupos de valores, los "Encabezados de pivote" deben tener los 4 valores distintos.
Gracias a ambos, @Ashish_Mathur y @lbendlin. Por confidencialidad, mantuve mis datos vagos, pero sus comentarios me indicaron la dirección correcta.
Para ayudar a otros, aquí está la explicación general de lo que hice:
En general, lo que quieres es anular la pivotación y luego volver a pivotar. La clave es colocar los encabezados pivotantes resultantes deseados en una sola columna de "Encabezados pivote". Entonces, si desea terminar con 4 grupos de valores, los "Encabezados de pivote" deben tener los 4 valores distintos.
Hola
Si sus datos no son muy grandes, entonces este código M debería funcionar
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Transposed Table" = Table.Transpose(Source),
#"Filled Down" = Table.FillDown(#"Transposed Table",{"Column1"}),
#"Merged Columns" = Table.CombineColumns(#"Filled Down",{"Column1", "Column2"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"Merged"),
#"Transposed Table1" = Table.Transpose(#"Merged Columns"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{",Country", type text}, {",Item", type text}, {"Organic,Jan", Int64.Type}, {"Organic,Feb", Int64.Type}, {"Organic,Mar", Int64.Type}, {"Organic,Apr", Int64.Type}, {"Organic,May", Int64.Type}, {"Organic,Jun", Int64.Type}, {"Organic,Jul", Int64.Type}, {"Organic,Aug", Int64.Type}, {"Organic,Sep", Int64.Type}, {"Organic,Oct", Int64.Type}, {"Organic,Nov", Int64.Type}, {"Organic,Dec", Int64.Type}, {"Promotion,Jan", Int64.Type}, {"Promotion,Feb", Int64.Type}, {"Promotion,Mar", Int64.Type}, {"Promotion,Apr", Int64.Type}, {"Promotion,May", Int64.Type}, {"Promotion,Jun", Int64.Type}, {"Promotion,Jul", Int64.Type}, {"Promotion,Aug", Int64.Type}, {"Promotion,Sep", Int64.Type}, {"Promotion,Oct", Int64.Type}, {"Promotion,Nov", Int64.Type}, {"Promotion,Dec", Int64.Type}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {",Country", ",Item"}, "Attribute", "Value"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute.1", type text}, {"Attribute.2", type text}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[Attribute.1]), "Attribute.1", "Value")
in
#"Pivoted Column"
Espero que esto ayude.
En su formulario actual, sus datos no se pueden utilizar, ya que darían lugar a nombres de columna duplicados que Power Query luego masacra.
¿Puede verificar y publicar el formato real de los datos sin procesar?
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.