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

dividir una celda con varias entradas

EstadoFruta

Cantidad

California

manzana

Pera

Uvas

12

15

30

Tengo un gran problema que heredé 😞

Hay varias entradas en una celda y me gustaría dar a cada línea dentro de la celda de fruta su propia fila para que pueda resumir las cantidades.

Estoy seguro de que esto ya está resuelto. ¿Puede alguien compartir el enlace a esta solución? 😞

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hola, @jjvaca1972

Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.

Mesa:

h1.png

Aquí están los códigos m para las transformaciones en 'Advanced Editor'.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wck7MyUzLL8rLTFTSUXIsKMhJjckLSE0sislzL0osSC0GihoaxeQZmsbkGRsoxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [State = _t, Fruit = _t, Quantity = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"State", type text}, {"Fruit", type text}, {"Quantity", type text}}),
    Custom1 = Table.TransformColumns(#"Changed Type",{{"Fruit",each Text.Split(_,"#(lf)")},{"Quantity",each Text.Split(_,"#(lf)")}}),
    #"Added Custom" = Table.AddColumn(Custom1, "Custom", each let f=[Fruit] in
List.Generate(
    ()=>0,
    each _<=List.Count(f)-1,
    each _+1
)),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Added Custom1" = Table.AddColumn(#"Expanded Custom", "NewFruit", each [Fruit]{[Custom]}),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "NewQuantity", each [Quantity]{[Custom]}),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom2",{"Fruit", "Quantity", "Custom"})
in
    #"Removed Columns"

Resultado:

h2.png

Saludos

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

themistoklis
Community Champion
Community Champion
PhilipTreacy
Super User
Super User

Hola @jjvaca1972

¿Puede compartir algunos datos de origen en un archivo por favor? No está claro si los datos como se muestra están en celsl combinado o lo que el delimitador está entre palabras y valores. ¿Espacios?

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


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.

Top Kudoed Authors