cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alucard00 Frequent Visitor
Frequent Visitor

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

Accepted Solutions
LivioLanzo Super Contributor
Super Contributor

Re: Split CSV values in a column into multiple rows

Hi @Alucard00

 

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!  

2 REPLIES 2
LivioLanzo Super Contributor
Super Contributor

Re: Split CSV values in a column into multiple rows

Hi @Alucard00

 

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!  

Alucard00 Frequent Visitor
Frequent Visitor

Re: Split CSV values in a column into multiple rows

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

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 293 members 3,063 guests
Please welcome our newest community members: