CONvertir filas como encabezados de columna

Un usuario Pregunto ✅

Anónimo

Hola a todos,

He cargado los siguientes datos en el escritorio.

Servicio Subgrupo atributo valor
auditoría Iniciar sesión ene 8
auditoría Iniciar sesión feb 9
auditoría Iniciar sesión mar 10
auditoría Iniciar sesión abr 11
auditoría Iniciar sesión mayo 12
auditoría afc ene 6
auditoría afc feb 7
auditoría afc mar 8
auditoría afc abr 9
auditoría afc mayo 10
auditoría cnf ene 11
auditoría cnf feb 12
auditoría cnf mar 13
auditoría cnf abr 14
auditoría cnf mayo 15
auditoría rgb ene dieciséis
auditoría rgb feb 17
auditoría rgb mar 18
auditoría rgb abr 19
auditoría rgb mayo 20
depurar Iniciar sesión ene 14
depurar Iniciar sesión feb 15
depurar Iniciar sesión mar dieciséis
depurar Iniciar sesión abr 17
depurar Iniciar sesión mayo 18
depurar afc ene 19
depurar afc feb 20
depurar afc mar 5
depurar afc abr 6
depurar afc mayo 7
depurar cnf ene 8
depurar cnf feb 9
depurar cnf mar 10
depurar cnf abr 1
depurar cnf mayo 2
depurar rgb ene 3
depurar rgb feb 4
depurar rgb mar 5
depurar rgb abr 5
depurar rgb mayo 6

Ahora, en el editor de consultas, debe convertir los valores del subgrupo como encabezados en el siguiente formato.

Servicio atributo Iniciar sesión afc cnf rgb
auditoría ene 8 6 11 dieciséis
auditoría feb 9 7 12 17
auditoría mar 10 8 13 18
auditoría abr 11 9 14 19
auditoría mayo 12 10 15 20
depurar ene 14 19 8 3
depurar feb 15 20 9 4
depurar mar dieciséis 5 10 5
depurar abr 17 6 1 5
depurar mayo 18 7 2 6

¿Puede alguien por favor ayudar en esto lo antes posible?

Gracias

Praneeth

Hola @Anonimo,

Puede seleccionar la columna Sub grupo y luego haga clic en la columna pivote:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bZPLDoIwEEV/xXTNQlRe32FcERctFoJRIJWa8PcWZsQW72bS9OQmJ9PbshQvbd5tpUUkzhe1a0xvB3eW42haZcf5/i0fVotrVAppb+3obh594+Zddm7mgNRauVkA8pTGzXgPkBwWFMPUNKNDgGRdrRIpICSRAUISOSDkUMDM9C9edfWqsBEnRA4bcUK8iSNAvIkTTC0aSYCM+j1HnALEGhlArJEDxBoFTM0aB9rGTSvbbFrB8iFijQQg1kgBYo0Mpqaf/Bf5vWD5EJHGRt5vRgIIWaQwM609+xK/GDkg/gcJSfBBQsSLgKHlOQLil+IICCmcAEFL8BuBCBm49Vw/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"service", type text}, {"SUb group", type text}, {"attribute", type text}, {"value", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[#"SUb group"]), "SUb group", "value", List.Sum)
in
    #"Pivoted Column"

q9.PNG

Atentamente,
qiuyun yu

Anónimo

Hola a todos,

Tengo datos como los siguientes y los cargué en el escritorio power bi.

Servicio Subgrupo atributo valor
auditoría Iniciar sesión ene 8
auditoría Iniciar sesión feb 9
auditoría Iniciar sesión mar 10
auditoría Iniciar sesión abr 11
auditoría Iniciar sesión mayo 12
auditoría Iniciar sesión ene 6
auditoría Iniciar sesión feb 7
auditoría Iniciar sesión mar 8
auditoría Iniciar sesión abr 9
auditoría Iniciar sesión mayo 10
auditoría cnf ene 11
auditoría cnf feb 12
auditoría cnf mar 13
auditoría cnf abr 14
auditoría cnf mayo 15
auditoría cnf ene dieciséis
auditoría cnf feb 17
auditoría cnf mar 18
auditoría cnf abr 19
auditoría cnf mayo 20
depurar Iniciar sesión ene 14
depurar Iniciar sesión feb 15
depurar Iniciar sesión mar dieciséis
depurar Iniciar sesión abr 17
depurar Iniciar sesión mayo 18
depurar Iniciar sesión ene 19
depurar Iniciar sesión feb 20
depurar Iniciar sesión mar 5
depurar Iniciar sesión abr 6
depurar Iniciar sesión mayo 7
depurar cnf ene 8
depurar cnf feb 9
depurar cnf mar 10
depurar cnf abr 1
depurar cnf mayo 2
depurar cnf ene 3
depurar cnf feb 4
depurar cnf mar 5
depurar cnf abr 5
depurar cnf mayo 6

Después de cargar datos en power bi, quiero transponerlos al siguiente formato usando el editor de consultas.

Servicio atributo Iniciar sesión afc cnf rgb
auditoría ene 8 6 11 dieciséis
auditoría feb 9 7 12 17
auditoría mar 10 8 13 18
auditoría abr 11 9 14 19
auditoría mayo 12 10 15 20
depurar ene 14 19 8 3
depurar feb 15 20 9 4
depurar mar dieciséis 5 10 5
depurar abr 17 6 1 5
depurar mayo 18 7 2 6

Por favor, ayúdame si alguien tiene una solución para esto.

Gracias

Praneeth

parar2k

En respuesta a Anónimo

@Anónimo basado en el conjunto de datos que proporcionó, ¿está buscando el siguiente resultado?

imagen.png

Hola @Anonimo,

Puede seleccionar la columna Sub grupo y luego haga clic en la columna pivote:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bZPLDoIwEEV/xXTNQlRe32FcERctFoJRIJWa8PcWZsQW72bS9OQmJ9PbshQvbd5tpUUkzhe1a0xvB3eW42haZcf5/i0fVotrVAppb+3obh594+Zddm7mgNRauVkA8pTGzXgPkBwWFMPUNKNDgGRdrRIpICSRAUISOSDkUMDM9C9edfWqsBEnRA4bcUK8iSNAvIkTTC0aSYCM+j1HnALEGhlArJEDxBoFTM0aB9rGTSvbbFrB8iFijQQg1kgBYo0Mpqaf/Bf5vWD5EJHGRt5vRgIIWaQwM609+xK/GDkg/gcJSfBBQsSLgKHlOQLil+IICCmcAEFL8BuBCBm49Vw/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"service", type text}, {"SUb group", type text}, {"attribute", type text}, {"value", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[#"SUb group"]), "SUb group", "value", List.Sum)
in
    #"Pivoted Column"

q9.PNG

Atentamente,
qiuyun yu

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *