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
Anonymous
Not applicable

Combinación de varias filas

Hola

Actualmente tengo algunos datos que aparecen así.

Nombre del ID Apellido Ubicación

3 John Smith Engalnd

3 John Smith España

En algunos casos, una persona puede tener 2 ubicaciones. y así es crear 2 filas para la misma persona. Lo ideal sería transformar los datos para que agregue un nuevo colum y elimine la otra fila.

Nombre del ID Apellido Ubicación1 Ubicación2

3 John Smith Inglaterra España

No sé si esto es una solución fácil, o es algo más avanzado, pero no puedo entenderlo.

Cualquier ayuda es apreciada

¡Gracias!

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hola

Este código M funciona

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    Partition = Table.Group(Source, {"ID"}, {{"Partition", each Table.AddIndexColumn(_, "Index",1,1), type table}}),
    #"Expanded Partition" = Table.ExpandTableColumn(Partition, "Partition", {"First Name", "Surname", "Location", "Index"}, {"First Name", "Surname", "Location", "Index"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Partition", "Custom", each "Location "&Number.ToText([Index])),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Custom]), "Custom", "Location")
in
    #"Pivoted Column"

Espero que esto ayude.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@Howardd

en la powerquery, haga clic en agrupar por, configurar consulte la captura de pantalla siguiente.

1.PNG

actualizar la fórmula cambiando List.Sum([location]) a Text.Combine([location],",")

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.