Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Syndicate_Admin
Administrator
Administrator

unpivot varias veces

Hola, necesito ayuda aquí. ¿Es posible despivotar la columna varias veces? por ejemplo:

Fecha de pruebaEquipoCable rojo ACable azul ACable amarillo ACable rojo BCable rojo BCable amarillo B
2018TRU 10.230.450.65111
2019TRU 10.250.480.69222
2020TRU 10.280.50.71333
2018TRU 20.320.50.7444
2019TRU 20.350.530.74555
2020TRU 20.380.580.78666

Quiero combinar el cable rojo A, el cable azul A y el cable amarillo A en una rebanadora. Luego, quiero combinar el cable rojo B, el cable amarillo B y el cable azul B en otra rebanadora. Descubrí que es imposible despivotizar de nuevo para los cables B después de unpivot para el cable A.

Espero que puedan guiarme sobre cómo resolver este asunto. Gracias.

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

@abgnfirdaus , Pruebe si esto puede ayudar

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XY/LDYAgEERbMZyJgeVrG0ZPhP7bkN3BjXgYJpH3wtiaIeerseY6782PdjsFqZikMpfXdCvGsRpAY4XBl6SBQW41gMIr/C1o5hPvKBIm0FcYZ9T8Jk0eZMK/FCaT5jdpGnMSqnBlTe8P", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date Tested" = _t, Equipment = _t, #"Red cable A" = _t, #"Blue cable A" = _t, #"Yellow cable A" = _t, #"Red cable B" = _t, #"Blue cable B" = _t, #"Yellow cable B" = _t]),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Date Tested", "Equipment"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Columns", "Attribute", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Attribute.1", "Attribute.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Date Tested", Int64.Type}, {"Equipment", type text}, {"Attribute.1", type text}, {"Attribute.2", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Attribute.2]), "Attribute.2", "Value", List.Max),
    #"Added Custom" = Table.AddColumn(#"Pivoted Column", "A.1", each [Attribute.1] & " A"),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "B.1", each [Attribute.1] & " B")
in
    #"Added Custom1"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.