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 valores de varias columnas en filas

Hola, chicos

me encanta este foro, tantos grandes consejos, muy útil!
Tengo un problema con mi mesa que me causa dolores de cabeza, espero que alguien pueda ayudarme con esto.

Este es mi status quo (simplificado)

A cada producto se le asigna un número diferente de códigos ICD (entre 1 y 130 CIE). Son productos médicos y el código icD (por ejemplo, A16.12) muestra la condición médica (por ejemplo, dolor de cabeza) para la que está aprobado el medicamento (por ejemplo, aspirina).

ProductoIngresosTexto antes del delimitadorTexto antes del delimitador
Producto A1 EURA16.12A23.9
Producto B2 EURA16.12A24
Producto C1 EURD15A24

La siguiente tabla muestra mi salida deseada.

Me gustaría reorganizar la tabla, de modo que pueda ver los ingresos no basados en el producto individual, sino basados en códigos ICD. La siguiente tabla muestra mi salida deseada.

ProductoIngresosA16.12D15A23.9A24
Producto A1 EUR1 EUR 1 EUR
Producto B2 EUR2 EUR 2 EUR
Producto C1 EUR 1 EUR 1 EUR

¡Esperamos saber de ti!

9 REPLIES 9
parry2k
Super User
Super User

@Beginner solución de conexión.

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.

Anonymous
Not applicable

Desafortunadamente, el archivo de solución no se abre para mí - ¿Podría publicar una captura de pantalla de la solución? ¡Sería genial! ¡Gracias por tu ayuda!

@Beginner está recibiendo cualquier error, adjuntado de nuevo.



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.

Anonymous
Not applicable

@parry2k ¡Muchas gracias por la solución! Así que básicamente tengo que despivod las columnas "Texto antes del delimitador", ¿correcto?

@Beginner sí señor, eso es todo. Lo tienes.

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.

Anonymous
Not applicable

Desafortunadamente, el archivo no se abre. ¿Podría publicar una captura de pantalla de la solución?

Anonymous
Not applicable

Beginner_0-1595690853363.png

Aquí hay una mejor versión de las tablas. La primera tabla es el status quo y la segunda tabla es la salida deseada.

Hola

Este código M funciona

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Revenue", type text}, {"Text Before Delimiter", type text}, {"Text Before Delimiter2", type text}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Product", "Revenue"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Removed Columns", "Revenue", "Revenue - Copy"),
    #"Pivoted Column" = Table.Pivot(#"Duplicated Column", List.Distinct(#"Duplicated Column"[Value]), "Value", "Revenue")
in
    #"Pivoted Column"

Espero que esto ayude.

Untitled.png


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

aquí está el código M para el Editor de consultas:

Mesa
Dejar
Source : Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCijKTylNLlFwVNJRMlRwDQ0C0C0o6GZnqGGGGkbGepVKsDkZE1DUCFOZCYoiZySzXAxNYSpiAQ", BinaryEncoding.Base64), Compression.Deflate)), let _t á ((tipo de texto que acepta valores NULL) meta [Serialized.Text ? true]) en la tabla de tipos [Producto - _t, Ingresos - _t, "Texto antes del delimitador" - _t, "Texto antes del delimitador.1" - _t]),
Tab1Selected ? Table.SelectColumns(Source,"Product", "Revenue", "Text Before Delimiter.1")
Tab1 - Table.RenameColumns(Tab1Selected,-"Text Before Delimiter.1", "Text Before Delimiter"-),
Tab2 - Table.SelectColumns(Source,-"Product", "Revenue", "Text Before Delimiter"-),
Custom1 - Tab1 & Tab2,
"Columna precedida" - Table.Pivot(Custom1, List.Distinct(Custom1[-"Text Before Delimiter"]), "Text Before Delimiter", "Revenue")
En
"Columna pivotada"
Maxim Zelensky
excel-inside.pro

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.