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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
ashkid25
New Member

Transform data from row to column

I want to convert a large dataset withfeatures similar to table 1 into a format that looks like table 2. Can you please help me?

 

Table 1

Netcast ItemPlaceholder
Fees123456, 654321, 987654
FX555555
Others159357, 753951

 

Table 2

PaceholderNetcast Item
123456Fees
654321Fees
987654Fees
555555FX
159357Others
753951Others
1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

Convert your Placeholder column to a List, then expand it to new rows.

Paste the code below into a blank query to understand how it works. Then you can adapt it to your actual query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcktNLVbSUTI0MjYxNdNRMDM1MTYy1FGwtDAHMpVidYAqIoDypmAA5vuXZKQWgfWYWhqbmusomJsaW5oaKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Netcast Item" = _t, Placeholder = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Netcast Item", type text}, {"Placeholder", type text}}),
    #"Convert to Lists" = Table.TransformColumns(#"Changed Type", {"Placeholder", each 
        List.Transform(Text.Split(_,","), (l)=>Text.Trim(l)), type {text}}),
    
    #"Expanded Placeholder" = Table.ExpandListColumn(#"Convert to Lists", "Placeholder"),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Placeholder",{"Placeholder", "Netcast Item"})
in
    #"Reordered Columns"

 

Source

ronrsnfld_0-1722190565826.png

Results

ronrsnfld_1-1722190583279.png

View solution in original post

1 REPLY 1
ronrsnfld
Super User
Super User

Convert your Placeholder column to a List, then expand it to new rows.

Paste the code below into a blank query to understand how it works. Then you can adapt it to your actual query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcktNLVbSUTI0MjYxNdNRMDM1MTYy1FGwtDAHMpVidYAqIoDypmAA5vuXZKQWgfWYWhqbmusomJsaW5oaKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Netcast Item" = _t, Placeholder = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Netcast Item", type text}, {"Placeholder", type text}}),
    #"Convert to Lists" = Table.TransformColumns(#"Changed Type", {"Placeholder", each 
        List.Transform(Text.Split(_,","), (l)=>Text.Trim(l)), type {text}}),
    
    #"Expanded Placeholder" = Table.ExpandListColumn(#"Convert to Lists", "Placeholder"),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Placeholder",{"Placeholder", "Netcast Item"})
in
    #"Reordered Columns"

 

Source

ronrsnfld_0-1722190565826.png

Results

ronrsnfld_1-1722190583279.png

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.