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! Learn more

Reply
DaubPitt
New Member

Transform Table from vertical to horizontal

Hello Community,

I read data from Excel files files that are stored in different folders. Every Excel file has the same structure. I performed some power query steps (as a beginner) to generate a table that's look good for my needs. But there is one thing, that I have to change. See screenshot.
How can I do this? I like to use the Excel data later for creating a Share Point List and the "Issue-No." will be the "Primary Key" = ID. 
Thank you in advance for any tips.

PQ Question.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DaubPitt ,

 

Below are the setps.

1.Select two columns(Hold down the Ctrl key while the mouse selects.), then click 'Unpivot Columns'.

vstephenmsft_0-1653642341241.png

vstephenmsft_1-1653642405933.png

2.Remove the 'Attribute' column.

vstephenmsft_2-1653642440122.png

vstephenmsft_3-1653642447064.png

 

3.Change the 'Value' column to text type.

vstephenmsft_4-1653642493464.png

 

4.Group on โ€™Issue-Noโ€˜, choose some dummy operation for FULLNAME (e.g. Max, not "All Rows") and then adjust the generated code to combine the names.

vstephenmsft_5-1653643061941.png

 

5.Spilt the column with ";".

vstephenmsft_6-1653643090090.pngvstephenmsft_7-1653643108741.png

 

Result:

vstephenmsft_8-1653643399208.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

6 REPLIES 6
wdx223_Daniel
Super User
Super User

NewStep=Table.Combine(Table.Group(PreviousStepName,"Issue-No.",{"n",each #table(null,List.Combine(Table.ToRow(_)))})[n])

Vijay_A_Verma
Super User
Super User

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc5NDgARDAXgu1iLqCqZ5ZxD3P8a059BLSQv30M7RoCCIQbg80KYcUPKuSpqOEURLB74wqOo4RRdsHtIGXWQBSka1Xv6D/wVrunoCsUL+II+tyAFVgESJA9rT9p7WtEEm4cE9qeFOT8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Issue-No." = _t, #"Step-No" = _t, #"Step-No-Desc" = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Issue-No."}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Issue-No."}, {{"Column", each Text.Combine([Value],";"), type any}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Grouped Rows", "Column", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), List.Transform({1..List.Max(Table.AddColumn(#"Grouped Rows", "Temp", each List.Count(Text.Split([Column],";")))[Temp])},each "Column " & Number.ToText(_)))
in
    #"Split Column by Delimiter"

 

First of all, thank you very much for your quick support ๐Ÿ™‚
I did the steps as you describe, but it does'nt work as I expected. See attached screenshot.
In this case, I only used the first row of source code. 
"Source = Table.FromRows(Json.Document(Binary.Decompress(..."
Why the Issue-No are different from Issue-No in my table?

PQ-01.jpg

Anonymous
Not applicable

Hi @DaubPitt ,

 

Below are the setps.

1.Select two columns(Hold down the Ctrl key while the mouse selects.), then click 'Unpivot Columns'.

vstephenmsft_0-1653642341241.png

vstephenmsft_1-1653642405933.png

2.Remove the 'Attribute' column.

vstephenmsft_2-1653642440122.png

vstephenmsft_3-1653642447064.png

 

3.Change the 'Value' column to text type.

vstephenmsft_4-1653642493464.png

 

4.Group on โ€™Issue-Noโ€˜, choose some dummy operation for FULLNAME (e.g. Max, not "All Rows") and then adjust the generated code to combine the names.

vstephenmsft_5-1653643061941.png

 

5.Spilt the column with ";".

vstephenmsft_6-1653643090090.pngvstephenmsft_7-1653643108741.png

 

Result:

vstephenmsft_8-1653643399208.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Wow, thank you !

Since your Excel doesn't contain any sensitive info, could you please upload the file without confidential/sensitive data to a cloud storage service such as Onedrive/Google Drive/Dropbox/Box (Onedrive preferred) and share the link here?

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