Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Pind
Regular Visitor

Combine Cell With One Above

I am trying to combine the cell with the cell above it, and keep in in its current place. For Excample please see below.

 

Old Column A   Old Column B              New Column A        New Column b

Circle                  Red                             Circle Square            Red

Square                Blue                            Square Triangle        Blue

Triangle               Green                         Triangle ...                Green

 

Thanks in advanced!

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @Pind ,

 

Please create a new blank query in the PowerQuery editor, copy the code into the Advanced Editor and refer to the steps therein.

let
    fx=(x)=>List.PositionOf(Table.ToColumns(#"Changed Type"){0},x),
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs4sSs5JVdJRCkpNUYrViVYKLixNLAIJOOWUpoJFQooyE/PSwYrci1JT85RiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Old Column A" = _t, #"Old Column B" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Old Column A", type text}, {"Old Column B", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "New Column A", each try #"Changed Type"[Old Column A]{fx([Old Column A])}&" "&#"Changed Type"[Old Column A]{fx([Old Column A])+1} otherwise #"Changed Type"[Old Column A]{fx([Old Column A])})
in
    #"Added Custom"

vcgaomsft_0-1675302674880.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @Pind ,

 

Please create a new blank query in the PowerQuery editor, copy the code into the Advanced Editor and refer to the steps therein.

let
    fx=(x)=>List.PositionOf(Table.ToColumns(#"Changed Type"){0},x),
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs4sSs5JVdJRCkpNUYrViVYKLixNLAIJOOWUpoJFQooyE/PSwYrci1JT85RiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Old Column A" = _t, #"Old Column B" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Old Column A", type text}, {"Old Column B", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "New Column A", each try #"Changed Type"[Old Column A]{fx([Old Column A])}&" "&#"Changed Type"[Old Column A]{fx([Old Column A])+1} otherwise #"Changed Type"[Old Column A]{fx([Old Column A])})
in
    #"Added Custom"

vcgaomsft_0-1675302674880.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

v-cgao-msft
Community Support
Community Support

Hi @Pind ,

 

Please create a new blank query in the PowerQuery editor, copy the code into the Advanced Editor and refer to the steps therein.

let
    fx=(x)=>List.PositionOf(Table.ToColumns(#"Changed Type"){0},x),
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs4sSs5JVdJRCkpNUYrViVYKLixNLAIJOOWUpoJFQooyE/PSwYrci1JT85RiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Old Column A" = _t, #"Old Column B" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Old Column A", type text}, {"Old Column B", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "New Column A", each try #"Changed Type"[Old Column A]{fx([Old Column A])}&" "&#"Changed Type"[Old Column A]{fx([Old Column A])+1} otherwise #"Changed Type"[Old Column A]{fx([Old Column A])})
in
    #"Added Custom"

vcgaomsft_0-1675302674880.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors