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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
clgrantmidd
Frequent Visitor

Agrupar entonces Transponer/Pivotar con valores de texto

Estoy buscando agrupar valores por FundID y luego lista hacer un pivote o transponer para 3 nuevas columnas (Tipo de relación) y tener los nombres de relación debajo. Si hay más de un valor, que se separe por comas. He publicado esto en Power Query, pero no obtuve mucha respuesta. Sé que Agrupe entonces haga Todas las filas, No agregue. Está trabajando con la subtabla que no estoy haciendo lo correcto. La segunda parte es la forma en que lo necesito.

Gracias por cualquier ayuda!

-Carol

data_sample.PNG

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hola @clgrantmidd

Simplemente pruebe estos pasos en las consultas de edición:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rZI9a8NADIb/ivCcwc3QkNFNaYuhEGLSDiaD6lOw4HxndLKD/33OLmkgmUo8CX3wvHqFyjJZrtJ09ZQski+sUNk7eOucifkYgAMcvcClF8sbFG+haFjry9COWi+aHBb/p71izwZy7yjErKhqb1FCze0j0A0qfPou0HzInEQGyKT7wRlcF2jtAN9sLWMzGdfOkFPITiiGzC/0OV2uY++dHAnGk1+d3PiKAnsnFFS4Uhp1c0/wgQ1bnfTu9n0A/UI9ybg9apgdviUl+Xuuu6sczg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [FundID = _t, FundDesc = _t, #"Fund Notes" = _t, #"Relationship Name" = _t, #"Relationship Type" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"FundID", Int64.Type}, {"FundDesc", type text}, {"Fund Notes", type text}, {"Relationship Name", type text}, {"Relationship Type", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"FundID", "FundDesc", "Fund Notes", "Relationship Type"}, {{"Data", each _, type table [FundID=number, FundDesc=text, Fund Notes=text, Relationship Name=text, Relationship Type=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([Data],"Relationship Name")),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
    #"Extracted Values" = Table.TransformColumns(#"Removed Columns", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    #"Pivoted Column" = Table.Pivot(#"Extracted Values", List.Distinct(#"Extracted Values"[#"Relationship Type"]), "Relationship Type", "Custom")
in
    #"Pivoted Column"

Resultado:

1.JPG

y aquí está el archivo pbix de muestra, por favor pruébelo.

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Eso funcionó perfectamente Lin- gracias!

-Carol

vanessafvg
Super User
Super User

puede copiar y pegar los datos en formato de texto?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Aquí tienes. ¿Te gustaría como formato csv o funciona?

FundID FundDesc Fondo Notas Relación Nombre Relación Tipo de Relación
270071 Fondo de Vacaciones es para Vacation Carol Smith Fund Informe
270071 Vacation Fund Fund es para Vacation David Jones Scholarship Report
270071 Vacation Fund Fund es para Vacation Cat Mouse Scholarship Report
270071 Fondo de Vacaciones es para Vacation Jerry Aruba Fund Informe
270071 Vacation Fund Fund es para Vacation Sally Williams Student Warded
26029 Beca General es Unrestricted Joe Hamilton Fund Report
26029 La Beca General de Becas es un informe sin restricciones del Fondo Beverly Watson
26029 Beca General es unsinrestriccion peter Smith Estudiante otorgado

si puede separar los valores que sería mejor, ya que todavía me requeriría escribir manualmente y arreglar cosas en ese formato





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Aquí tienes, gracias

FundID,FundDesc,Fund Notes,Relationship Name,Relationship Type
270071,Fondo de Vacaciones,Fondo es para Vacaciones,Carol Smith,Informe del Fondo
270071,Fondo de Vacaciones,Fund es para Vacaciones,David Jones,Informe de Becas
270071, Fondo de Vacaciones, Fondo es para Vacaciones, Ratón Gato, Informe de Becas
270071,Fondo de Vacaciones,Fondo es para Vacaciones,Jerry Aruba,Informe del Fondo
270071, Fondo de Vacaciones, El Fondo es para Vacaciones, Sally Williams, Estudiante Premiado
26029, Beca General, La beca es sin restricciones, Joe Hamilton, Informe del Fondo
26029, Beca General, La beca es Sin restricciones, Beverly Watson, Informe del Fondo
26029, Beca General, Beca es Sin restricciones, Peter Smith, Estudiante otorgado

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors