cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Fusionar dos columnas de una misma tabla

Saludos a toda la comunidad, les presento mi consulta. Tengo una tabla con dos columnas de fechas, una para ingresos y otra para egresos (tabla 1) pero me gustaría fusionarlas en una sóla columna como muestro en la siguiente imagen, cómo puedo lograr esto?

Captura.PNG 

Les agradezco sus aportes

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Helper II
Helper II

Re: Combinar dos columnas de la misma tabla

Hola @MauricioChamas

Intente crear una tabla calculada utilizando esta fórmula:

Table2 = UNION(
ADDCOLUMNS(SUMMARIZE(Table1,nombre, fecha ingreso, "monto", SUM(Ingreso)),"descripcion", "ingreso"),
ADDCOLUMNS(SUMMARIZE(Table1,nombre, fecha ingreso, "monto", SUM(gasto)),"descripcion", "gasto"))

View solution in original post

Highlighted
Super User IV
Super User IV

Re: Combinar dos columnas de la misma tabla

4 REPLIES 4
Highlighted
Helper II
Helper II

Re: Combinar dos columnas de la misma tabla

Hola @MauricioChamas

Intente crear una tabla calculada utilizando esta fórmula:

Table2 = UNION(
ADDCOLUMNS(SUMMARIZE(Table1,nombre, fecha ingreso, "monto", SUM(Ingreso)),"descripcion", "ingreso"),
ADDCOLUMNS(SUMMARIZE(Table1,nombre, fecha ingreso, "monto", SUM(gasto)),"descripcion", "gasto"))

View solution in original post

Highlighted
Super User IV
Super User IV

Re: Combinar dos columnas de la misma tabla

Highlighted
Community Support
Community Support

Re: Combinar dos columnas de la misma tabla

Hola @MauricioChamas ,

Puede consultar a continuación el código M

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WyipNzFPSUTIyMDLQN9Q3BDINDQxQBSwMlGJ1opUKEpNy8mEyZmAZI4RSc4heqNrkxKKc/GK4MRBzjJEMNoLoBymPBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [nombre = _t, #"fecha ingreso" = _t, ingreso = _t, #"fecha gasto" = _t, gasto = _t]),
    #"Demoted Headers" = Table.DemoteHeaders(Source),
    #"Changed Type" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}}),
    #"Merged Columns" = Table.CombineColumns(#"Changed Type",{"Column2", "Column3"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"Merged"),
    #"Merged Columns1" = Table.CombineColumns(#"Merged Columns",{"Column4", "Column5"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"Merged.1"),
    #"Promoted Headers" = Table.PromoteHeaders(#"Merged Columns1", [PromoteAllScalars=true]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"nombre"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Value", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Value.1", "Value.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Value.1", type date}, {"Value.2", Int64.Type}}),
    #"Extracted Text After Delimiter" = Table.TransformColumns(#"Changed Type1", {{"Attribute", each Text.AfterDelimiter(_, ","), type text}}),
    #"Renamed Columns" = Table.RenameColumns(#"Extracted Text After Delimiter",{{"Value.1", "monto"}, {"Attribute", "description"}, {"Value.2", "ingreso"}})
in
    #"Renamed Columns"

Saludos
Zoe Zhi

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

Highlighted
Super User IV
Super User IV

Re: Combinar dos columnas de la misma tabla

Hola

Compartir datos en un formato que se puede pegar en un libro de Excel.


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

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.