Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hola
Tengo esta tabla:
Fecha | A | B | C |
5-Jan | 9 | 43 | 133 |
6-Jan | 2 | 48 | 118 |
Fecha | B | D | A |
7-Jan | 17 | 1050 | 7 |
8-Jan | 14 | 1257 | 4 |
La salida deseada tiene el siguiente aspecto:
Fecha | Artículo | Valor |
5-Jan | A | 9 |
5-Jan | B | 43 |
5-Jan | C | 133 |
6-Jan | A | 2 |
6-Jan | B | 48 |
6-Jan | C | 118 |
7-Jan | A | 7 |
7-Jan | B | 17 |
7-Jan | D | 1050 |
8-Jan | A | 4 |
8-Jan | B | 14 |
8-Jan | D | 1257 |
¿Cómo sugieres que haga esto? Despvoro obviamente no funciona.
Hola @PiyushBQ
Copie y pegue mi consulta en el editor avanzado
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtX1SsxT0lGyBGITYyBhaGysFKsTrWQGlTACSViAJAwtwBIuiSWpQK4TELsAsSNY0Byq2tAcRBiYGgApc7CMBUzGBEQYmYIUmCjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, A = _t, B = _t, C = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}, {"A", type text}, {"B", type text}, {"C", type text}}),
#"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"),
#"Changed Type1" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type1", "Index", 1, 1),
#"Added Conditional Column" = Table.AddColumn(#"Added Index", "Custom", each if [Column1] = "Date" then [Index] else null),
#"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Custom"}),
#"Removed Columns" = Table.RemoveColumns(#"Filled Down",{"Index"}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"Column1", "Custom"}, "Attribute", "Value"),
#"Sorted Rows" = Table.Sort(#"Unpivoted Columns",{{"Custom", Order.Ascending}, {"Attribute", Order.Ascending}, {"Value", Order.Descending}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Sorted Rows", "Value", "Value - Copy"),
#"Changed Type2" = Table.TransformColumnTypes(#"Duplicated Column",{{"Value - Copy", type number}}),
#"Replaced Errors" = Table.ReplaceErrorValues(#"Changed Type2", {{"Value - Copy", 9999}}),
#"Added Conditional Column1" = Table.AddColumn(#"Replaced Errors", "Custom.1", each if [#"Value - Copy"] = 9999 then [Value] else null),
#"Filled Down1" = Table.FillDown(#"Added Conditional Column1",{"Custom.1"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down1", each [#"Value - Copy"] <> 9999),
#"Removed Columns1" = Table.RemoveColumns(#"Filtered Rows",{"Custom", "Attribute", "Value - Copy"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns1",{"Column1", "Custom.1", "Value"}),
#"Sorted Rows1" = Table.Sort(#"Reordered Columns",{{"Column1", Order.Ascending}, {"Custom.1", Order.Ascending}})
in
#"Sorted Rows1"
Saludos
Maggie
Equipo de apoyo a la comunidad _ Maggie Li
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Esto es perfecto, Maggie.
¡Muchas gracias!
@PiyushBQ unpivot debe funcionar y es la solución.
- transformar datos
- Seleccionar columna de fecha en la tabla de tablas
- haga clic con el botón derecho, despofen otras columnas agregará dos columnas, atributo y valor, cambiar el nombre de estos según su requisito
- cerrar y aplicar
Para visual, tome el objeto visual de tabla, coloque la fecha, el atributo y el valor para ver el resultado.
Me gustaría❤ elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!
⚡Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionados con Power BI.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Gracias por tomarse el tiempo fuera @parry2k
Despvoro es lo primero que intenté, y no funciona.
Aquí está la salida para usted (observe cómo D se pierde)
DateAttributeValue
1/5/2020 | A | 9 |
1/5/2020 | B | 43 |
1/5/2020 | C | 133 |
1/6/2020 | A | 2 |
1/6/2020 | B | 48 |
1/6/2020 | C | 118 |
Fecha | A | B |
Fecha | B | D |
Fecha | C | A |
1/7/2020 | A | 17 |
1/7/2020 | B | 1050 |
1/7/2020 | C | 7 |
1/8/2020 | A | 14 |
1/8/2020 | B | 1257 |
1/8/2020 | C | 4 |