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

Convertir rango de datos en una lista asignable

Hola amigos,

Tengo una tabla de datos se parece a esto

Ventas1:3
Costo4
Impuestos5:6

Quiero convertirlos en:

Ventas1
Ventas2
Ventas3
Costo4
Impuestos5
Impuestos6

¿Alguien tiene alguna idea?

Saludos

4 REPLIES 4
lbendlin
Super User
Super User

Esta es una forma (algo peatonal) de hacer eso en Power Query. Estoy seguro de que hay soluciones más elegantes.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk7MSS1W0lEytDJWitWJVnLOLy4Bck3AnJDECiDb1MpMKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Transaction Type" = _t, Range = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each let 
     d= Text.PositionOf([Range],":"),
     r= if d = -1 then List.Numbers(Number.FromText([Range]),1) 
                else List.Numbers(Number.FromText(Text.Start([Range],d)),1+Number.FromText(Text.End([Range],Text.Length([Range])-d-1))-Number.FromText(Text.Start([Range],d)))
   in 
      r
),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
    #"Expanded Custom"

@hsy es bastante sencillo, iniciar una nueva consulta en blanco y haga clic en editor avanzado y pegue el siguiente código

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk7MSS1W0lEytDJWitWJVnLOLy4Bck3AnJDECiDb1MpMKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Pos", each Text.PositionOf([B],":")),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "List", each if [Pos]=-1 then {Number.FromText([B])} else 
{Number.FromText(Text.Middle([B],0,[Pos]))..Number.FromText(Text.Middle([B],[Pos]+1))}),
    #"Expanded List" = Table.ExpandListColumn(#"Added Custom1", "List"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded List",{"Pos"})
in
    #"Removed Columns"

. La lógica principal está en el paso "Añadido Personalizado1"

Me gustaría elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!

Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Gracias @edhans por la inspiración:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk7MSS1W0lEytDJWitWJVnLOLy4Bck3AnJDECiDb1MpMKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Transaction Type" = _t, Range = _t]),
    #"Added Custom1" = Table.AddColumn(Source, "Custom.1", each Expression.Evaluate("{" & Text.Replace([Range],":","..") & "}")),
    #"Expanded Custom.1" = Table.ExpandListColumn(#"Added Custom1", "Custom.1")
in
    #"Expanded Custom.1"
Anonymous
Not applicable

Transequé la mesa en

Minmáximo
Ventas13
Costo44
Impuestos56

Todavía no estoy seguro de cómo puedo usarlo para mapear aunque...

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.