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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Kumar11109
Helper IV
Helper IV

How to put Comma Separated Values of a cell in separate rows

Dear All, 

 

I am struggling with a data-set. For each child the scores are in a cell separated by comma. I want first separate them and then put them in single row. The way it is shows below the data set. I have done that manually! Can some body help me? The above is the data set, and below is what I want. 

 

Screenshot (3).png

 

 

Thank You, 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

In Power Query you should be able to use Split Column by Delimiter on your Scores column (Transform tab in the Text column area) and then you can upivot the resulting columns.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs5JLC42U9JRckosTvXJzEsFMk11jHQMQVApNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [classtype = _t, #"type" = _t, scores = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "scores", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"scores.1", "scores.2", "scores.3", "scores.4", "scores.5"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"classtype", type text}, {"type", type text}, {"scores.1", Int64.Type}, {"scores.2", Int64.Type}, {"scores.3", Int64.Type}, {"scores.4", Int64.Type}, {"scores.5", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"classtype", "type"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"})
in
    #"Removed Columns"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

In Power Query you should be able to use Split Column by Delimiter on your Scores column (Transform tab in the Text column area) and then you can upivot the resulting columns.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs5JLC42U9JRckosTvXJzEsFMk11jHQMQVApNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [classtype = _t, #"type" = _t, scores = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "scores", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"scores.1", "scores.2", "scores.3", "scores.4", "scores.5"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"classtype", type text}, {"type", type text}, {"scores.1", Int64.Type}, {"scores.2", Int64.Type}, {"scores.3", Int64.Type}, {"scores.4", Int64.Type}, {"scores.5", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"classtype", "type"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"})
in
    #"Removed Columns"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.