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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Stocki-San
Regular Visitor

Transform Cell into Rows

Scenario:

 

Current Table:

 

ID  Date  Topic

1   1.1.18 X;Y,Z

2   2.1.18 X;Z

 

Transform to:

 

ID  Date  Topic

1   1.1.18 X

1   1.1.18 Y

1   1.1.18 Z

2   2.1.18 X

2   2.1.18 Z

 

Any Ideas? Other Solutions in the Forum didn't help.

 

 

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

2 Ideas.

 

1. Choose some transform operations on the transform columns menu, e.g. "Trim"(in the "Format" group) and adjust the generated code.

 

let
    Source = CurrentTable,
    #"Splitted Text" = Table.TransformColumns(Source,{{"Topic", each Text.Split(_,";"), type {text}}}),
    #"Expanded Topic" = Table.ExpandListColumn(#"Splitted Text", "Topic")
in
    #"Expanded Topic"

 

2. Use split column with advanced option Split into rows. Resulting code (no adjustment required):

 

let
    Source = CurrentTable,
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Topic", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Topic"),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Topic", type text}})
in
    #"Changed Type"
Specializing in Power Query Formula Language (M)

View solution in original post

2 REPLIES 2
MarcelBeug
Community Champion
Community Champion

2 Ideas.

 

1. Choose some transform operations on the transform columns menu, e.g. "Trim"(in the "Format" group) and adjust the generated code.

 

let
    Source = CurrentTable,
    #"Splitted Text" = Table.TransformColumns(Source,{{"Topic", each Text.Split(_,";"), type {text}}}),
    #"Expanded Topic" = Table.ExpandListColumn(#"Splitted Text", "Topic")
in
    #"Expanded Topic"

 

2. Use split column with advanced option Split into rows. Resulting code (no adjustment required):

 

let
    Source = CurrentTable,
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Topic", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Topic"),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Topic", type text}})
in
    #"Changed Type"
Specializing in Power Query Formula Language (M)
p0nk
Frequent Visitor

First split the Topic column by delimiter, in this case a semicolon.First split the Topic column by delimiter, in this case a semicolon.Repeat this step on the second columkn that has been created but this time for a comma.Repeat this step on the second columkn that has been created but this time for a comma.Select the Topic columns that have been created and press unpivot columns.Select the Topic columns that have been created and press unpivot columns.Remove the attribute column that was created from the unpivot and you have the end result.Remove the attribute column that was created from the unpivot and you have the end result.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.