cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Anexar columnas dentro de una tabla

Hola

Tengo una mesa como esta:

IdPronóstico1Pronóstico2Pronóstico3Actual1Actual2Actual3
1ABCDEF
2GHJKLM

Y quiero hacerlo como abajo en Power Query Editor. ¿Hay alguna manera de hacer esto sin tener varias tablas duplicadas y anexarlas de nuevo. ¡Gracias por la ayuda!

IdPronósticoActual End Num
1AD1
1BE2
1CF3
2GK1
2HL2
2JM3

1 ACCEPTED SOLUTION
mwegener
Super User
Super User

Hola @Shukurovasif ,

prueba esto. PBIX

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("DcY5DQAgEEVBL7+mAQfchEPBZv3b4BWTjJmigjIKKho6hjyYEptY2Di4eHL/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [ID = _t, Forecast1 = _t, Forecast2 = _t, Forecast3 = _t, Actual1 = _t, Actual2 = _t, Actual3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Forecast1", type text}, {"Forecast2", type text}, {"Forecast3", type text}, {"Actual1", type text}, {"Actual2", type text}, {"Actual3", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID"}, "Attribute", "Value"),
    #"Split Column by Character Transition" = Table.SplitColumn(#"Unpivoted Columns", "Attribute", Splitter.SplitTextByCharacterTransition((c) => not List.Contains({"0".."9"}, c), {"0".."9"}), {"Attribute.1", "Attribute.2"}),
    #"Pivoted Column" = Table.Pivot(#"Split Column by Character Transition", List.Distinct(#"Split Column by Character Transition"[Attribute.1]), "Attribute.1", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"Attribute.2", "End Num"}})
in
    #"Renamed Columns"

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

2 REPLIES 2
mwegener
Super User
Super User

Hola @Shukurovasif ,

prueba esto. PBIX

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("DcY5DQAgEEVBL7+mAQfchEPBZv3b4BWTjJmigjIKKho6hjyYEptY2Di4eHL/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [ID = _t, Forecast1 = _t, Forecast2 = _t, Forecast3 = _t, Actual1 = _t, Actual2 = _t, Actual3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Forecast1", type text}, {"Forecast2", type text}, {"Forecast3", type text}, {"Actual1", type text}, {"Actual2", type text}, {"Actual3", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID"}, "Attribute", "Value"),
    #"Split Column by Character Transition" = Table.SplitColumn(#"Unpivoted Columns", "Attribute", Splitter.SplitTextByCharacterTransition((c) => not List.Contains({"0".."9"}, c), {"0".."9"}), {"Attribute.1", "Attribute.2"}),
    #"Pivoted Column" = Table.Pivot(#"Split Column by Character Transition", List.Distinct(#"Split Column by Character Transition"[Attribute.1]), "Attribute.1", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"Attribute.2", "End Num"}})
in
    #"Renamed Columns"

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


kentyler
Solution Sage
Solution Sage

¿Puede decirnos cuál es el objetivo?

Esto parece uno de esos casos en los que tiene más sentido manipular los datos antes de cargarlos en Power BI.

La columna de "números finales" significa que va a hacer 3 pasadas sobre los datos base, y realizar un seguimiento del "número" de la pasada.

Hay funciones de código M que le permiten crear nuevas filas.... pero sería más fácil averiguarlo si supiéramos lo que intentas lograr.





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.