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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Irwan
Super User
Super User

Combining Multiple Column Into 1 Column

Hello PQ Expert,

 

i need an advice.

 

Here is my sample data

Irwan_2-1729385681419.png

 

i need to change the above sample data into like below.

Irwan_3-1729386351989.png

 

Thank you

4 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User
shafiz_p
Super User
Super User

Hi @Irwan  To acheive the desired result, follow the steps below:

Using merge and unpivot technique:

1. First Merge column2, Column3 with seperator, say semicolon. Repeate this process for Column4, 5 and Column6,7. 

 

See images below after merge:

shafiz_p_0-1729399081031.png

 

2. Now select Column1 and select Unpivot other columns. See image below:

shafiz_p_1-1729399159369.png

 

3. Now split "Value" column using delimiter (Semicolon). See image below:

shafiz_p_2-1729399231302.png

 

4. Now Change type to whole number and Sort the column "Value.1" in ascending order. See image below for your desired result:

shafiz_p_3-1729399338636.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution!!

 

Best Regards,
Shahariar Hafiz

 

 

View solution in original post

AlienSx
Super User
Super User

Table.FromRows(
    List.TransformMany(
        Table.ToRows(Source),
        (x) => List.Split(List.Skip(x), 2),
        (x, y) => {x{0}} & y
    )
)

View solution in original post

Omid_Motamedise
Super User
Super User

This problem can be solved in different way, but one of the most time efficent way is :

just copy and past the below code on Advance editor

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIEYmMgNgVicyC2BIkZKsXqRCs5AZlGQGwCxGZAbAGSMgARRkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t]),
    #"Merged Columns" = Table.CombineColumns(Source,List.Skip(Table.ColumnNames(Source)),each List.Split(_,2),"Merged"),
    #"Expanded Merged" = Table.ExpandListColumn(#"Merged Columns", "Merged"),
    #"Extracted Values" = Table.TransformColumns(#"Expanded Merged", {"Merged", each Record.FromList(_,{"Column2","Column3"})}),
    #"Expanded Merged1" = Table.ExpandRecordColumn(#"Extracted Values", "Merged", {"Column2", "Column3"}, {"Column2", "Column3"})
in
    #"Expanded Merged1"

If this answer helped resolve your issue, please consider marking it as the accepted answer. And if you found my response helpful, I'd appreciate it if you could give me kudos. 

Thank you!


If my answer helped solve your issue, please consider marking it as the accepted solution.

View solution in original post

5 REPLIES 5
Irwan
Super User
Super User

Hello @Ahmedx @shafiz_p @AlienSx @Omid_Motamedise 

 

superb solution, works as intended.

 

Thank you very much.

Omid_Motamedise
Super User
Super User

This problem can be solved in different way, but one of the most time efficent way is :

just copy and past the below code on Advance editor

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIEYmMgNgVicyC2BIkZKsXqRCs5AZlGQGwCxGZAbAGSMgARRkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t]),
    #"Merged Columns" = Table.CombineColumns(Source,List.Skip(Table.ColumnNames(Source)),each List.Split(_,2),"Merged"),
    #"Expanded Merged" = Table.ExpandListColumn(#"Merged Columns", "Merged"),
    #"Extracted Values" = Table.TransformColumns(#"Expanded Merged", {"Merged", each Record.FromList(_,{"Column2","Column3"})}),
    #"Expanded Merged1" = Table.ExpandRecordColumn(#"Extracted Values", "Merged", {"Column2", "Column3"}, {"Column2", "Column3"})
in
    #"Expanded Merged1"

If this answer helped resolve your issue, please consider marking it as the accepted answer. And if you found my response helpful, I'd appreciate it if you could give me kudos. 

Thank you!


If my answer helped solve your issue, please consider marking it as the accepted solution.
AlienSx
Super User
Super User

Table.FromRows(
    List.TransformMany(
        Table.ToRows(Source),
        (x) => List.Split(List.Skip(x), 2),
        (x, y) => {x{0}} & y
    )
)
shafiz_p
Super User
Super User

Hi @Irwan  To acheive the desired result, follow the steps below:

Using merge and unpivot technique:

1. First Merge column2, Column3 with seperator, say semicolon. Repeate this process for Column4, 5 and Column6,7. 

 

See images below after merge:

shafiz_p_0-1729399081031.png

 

2. Now select Column1 and select Unpivot other columns. See image below:

shafiz_p_1-1729399159369.png

 

3. Now split "Value" column using delimiter (Semicolon). See image below:

shafiz_p_2-1729399231302.png

 

4. Now Change type to whole number and Sort the column "Value.1" in ascending order. See image below for your desired result:

shafiz_p_3-1729399338636.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution!!

 

Best Regards,
Shahariar Hafiz

 

 

Ahmedx
Super User
Super User

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors