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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Split CSV values in a column into multiple rows

Hello,

 

I'm quite new to DAX. I need your help for transforming a table from somthing like:

 

Name | Type

A  |  f,g

B  |  f,i,h

C  |  p

 

into something like:

 

Name | Type

A  |  f

A  |  g

B  |  f

B  |  i

B  |  h

C  |  p

 

Thanks in advance!

1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

Hi @Anonymous

 

you can do it like this:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUUrTSVeK1YlWcgKzM3UywDxnIK9AKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Type = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Type", type text}}),
    SplitColumnbyDelimiter = Table.ExpandListColumn(Table.TransformColumns(ChangedType, {{"Type", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Type")
in
    SplitColumnbyDelimiter

 

2019-02-08_16-41-24.jpg2019-02-08_16-41-37.jpg

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

2 REPLIES 2
LivioLanzo
Solution Sage
Solution Sage

Hi @Anonymous

 

you can do it like this:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUUrTSVeK1YlWcgKzM3UywDxnIK9AKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Type = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Type", type text}}),
    SplitColumnbyDelimiter = Table.ExpandListColumn(Table.TransformColumns(ChangedType, {{"Type", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Type")
in
    SplitColumnbyDelimiter

 

2019-02-08_16-41-24.jpg2019-02-08_16-41-37.jpg

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

Thanks, that's solved the problem like a charm!

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.