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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
jerryr125
Helper IV
Helper IV

Power Query - create multiple rows

Hi - I would like to do the following - create a row for each value in a field.

 

Example:

 

IDFood Type
1Ice Cream; Cake; Cookies
2Apples; Bananas; Pears; Peaches
3Pizza


Output:

 

IDFood Type
1Ice Cream
1Cake
1Cookies
2Apples
2Bananas
2Peaches
2Pears
3Pizza


Therefore, the ";" indicates a new record (so to speak) - any thoughts ? Jerry

3 ACCEPTED SOLUTIONS
ronrsnfld
Super User
Super User

Source

ronrsnfld_0-1732311317004.png

 

 

You turn the string into a List, and then expand it:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJMTlVwLkpNzLVWcE7MTgWS+fnZmanFSrE60UpGQAWOBQU5qcXWCk6JeUAIZASkJhZBqOQMqDpjoLqAzKqqRKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Food Type" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Food Type", type text}}),
    #"Create List" = Table.TransformColumns(#"Changed Type",{"Food Type", each Text.Split(_,";"),type {text}}),
    #"Expanded Food Type" = Table.ExpandListColumn(#"Create List", "Food Type")
in
    #"Expanded Food Type"

 

Result

ronrsnfld_1-1732311349657.png

 

 

 

View solution in original post

AntrikshSharma
Super User
Super User

@jerryr125 Many ways to solve this, here is one using List.TransformMany

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJMTlVwLkpNzLVWcE7MTgWS+fnZmanFSrE60UpGQAWOBQU5qcXWCk6JeUAIZASkJhZBqOQMqDpjoLqAzKqqRKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Food Type" = _t]),
    ChangedType =
        Table.TransformColumnTypes ( Source, { { "ID", Int64.Type } } ), 
    Transform = 
        List.TransformMany (
            Table.ToRows ( ChangedType ), 
            ( z ) => Text.SplitAny ( z{1}, ";" ), 
            ( x, y ) => { x{0}, y }
        ), 
    ToTable = 
        Table.FromRows ( 
            Transform, 
            type table [ ID = Int64.Type, Food Type = text ] 
        )
in
    ToTable

AntrikshSharma_0-1732337135973.png

 

View solution in original post

Omid_Motamedise
Super User
Super User

Hi @jerryr125 , you can solve this problem by UI, just select the column Food Type, go to the homw tab, select Split Column by delimiter and make the setting presented in the below picture (it is important to select by row)

 

Omid_Motamedise_0-1732355213701.png

 


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

View solution in original post

4 REPLIES 4
Omid_Motamedise
Super User
Super User

Hi @jerryr125 , you can solve this problem by UI, just select the column Food Type, go to the homw tab, select Split Column by delimiter and make the setting presented in the below picture (it is important to select by row)

 

Omid_Motamedise_0-1732355213701.png

 


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

@jerryr125 Many ways to solve this, here is one using List.TransformMany

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJMTlVwLkpNzLVWcE7MTgWS+fnZmanFSrE60UpGQAWOBQU5qcXWCk6JeUAIZASkJhZBqOQMqDpjoLqAzKqqRKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Food Type" = _t]),
    ChangedType =
        Table.TransformColumnTypes ( Source, { { "ID", Int64.Type } } ), 
    Transform = 
        List.TransformMany (
            Table.ToRows ( ChangedType ), 
            ( z ) => Text.SplitAny ( z{1}, ";" ), 
            ( x, y ) => { x{0}, y }
        ), 
    ToTable = 
        Table.FromRows ( 
            Transform, 
            type table [ ID = Int64.Type, Food Type = text ] 
        )
in
    ToTable

AntrikshSharma_0-1732337135973.png

 

jerryr125
Helper IV
Helper IV

Hi - I did a split then a unpivot and solved it - thanks so much - Jerry

ronrsnfld
Super User
Super User

Source

ronrsnfld_0-1732311317004.png

 

 

You turn the string into a List, and then expand it:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJMTlVwLkpNzLVWcE7MTgWS+fnZmanFSrE60UpGQAWOBQU5qcXWCk6JeUAIZASkJhZBqOQMqDpjoLqAzKqqRKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Food Type" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Food Type", type text}}),
    #"Create List" = Table.TransformColumns(#"Changed Type",{"Food Type", each Text.Split(_,";"),type {text}}),
    #"Expanded Food Type" = Table.ExpandListColumn(#"Create List", "Food Type")
in
    #"Expanded Food Type"

 

Result

ronrsnfld_1-1732311349657.png

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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 Solution Authors