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.
Hola a todos
Tengo los siguientes datos de SAP:
Como puede ver, las 4 filas de datos son muy similares, a excepción de la columna asociada. Por lo tanto, le gustaría transformar y agrupar los datos en una solución similar a la siguiente:
¿Saben si esto se puede lograr a través de Power Query?
Nota: Los datos son solo datos ficticios, y en el conjunto de datos real, tengo múltiples notifactions con diferentes números de socios (en el ejemplo anterior hay 4 socios, sin embargo, puede variar de 3 a 6 partes.
De antemano - gracias por su ayuda
/Anónimo
Solved! Go to Solution.
Hola
Este código M funciona
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Notification", Int64.Type}, {"Typ", type text}, {"Create On", type date}, {"Material", type text}, {"Partner", type text}}),
Partition = Table.Group(#"Changed Type", {"Notification"}, {{"Partition", each Table.AddIndexColumn(_, "Index",1,1), type table}}),
#"Expanded Partition" = Table.ExpandTableColumn(Partition, "Partition", {"Typ", "Create On", "Material", "Partner", "Index"}, {"Typ", "Create On", "Material", "Partner", "Index"}),
#"Added Prefix" = Table.TransformColumns(#"Expanded Partition", {{"Index", each "Partner " & Text.From(_, "en-IN"), type text}}),
#"Pivoted Column" = Table.Pivot(#"Added Prefix", List.Distinct(#"Added Prefix"[Index]), "Index", "Partner")
in
#"Pivoted Column"
Espero que esto ayude.
Hola
Este código M funciona
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Notification", Int64.Type}, {"Typ", type text}, {"Create On", type date}, {"Material", type text}, {"Partner", type text}}),
Partition = Table.Group(#"Changed Type", {"Notification"}, {{"Partition", each Table.AddIndexColumn(_, "Index",1,1), type table}}),
#"Expanded Partition" = Table.ExpandTableColumn(Partition, "Partition", {"Typ", "Create On", "Material", "Partner", "Index"}, {"Typ", "Create On", "Material", "Partner", "Index"}),
#"Added Prefix" = Table.TransformColumns(#"Expanded Partition", {{"Index", each "Partner " & Text.From(_, "en-IN"), type text}}),
#"Pivoted Column" = Table.Pivot(#"Added Prefix", List.Distinct(#"Added Prefix"[Index]), "Index", "Partner")
in
#"Pivoted Column"
Espero que esto ayude.
Hola, para tu caso, ¿no sería mejor dividirlo en una tabla de hechos y dimensiones?
A continuación se muestra el trato que hice:
Basándome en los datos creé dos tablas
Entonces creé la relación:
Entiendo que de esta manera sus análisis serán mucho más fáciles.
Si desea descargar el archivo de ejemplo que creé, siga el enlace:
https://github.com/roolsant/SOSPowerBI/blob/main/Transform_Data.zip
Espero haberte ayudado.
Rodrigo Santos
https://www.linkedin.com/in/rodrigosanpbi/
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 |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |