cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Antiparras Regular Visitor
Regular Visitor

Sorting header and data columns separated by commas

This might be quite easy to solve but I'm stuck with this for a while now.

I've got this "simple" estructure coming from a XML file:

 

headersdata
name,surname,address,city,phoneJohn,Smith,Baker st. 21B,London,3758
name,surname,address,city,phoneCarol,Newman,Picadilly 23,London,5663
name,surname,address,city,phoneBernard,Collins,7th Avenue 432,NYC,3456

 

and obviously what I would like would be something like:

 

namesurnameaddresscityphone
JohnSmithBaker st. 21BLondon3758
CarolNewmanPicadilly 23London5663
BernardCollins7th Avenue 432NYC3456

 

Now take in consideration that we're talking about millions of rows and there are more headers than in the example, so performance matters here. Please, could anybody provide any tips? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Stachu Super Contributor
Super Contributor

Re: Sorting header and data columns separated by commas

in Query editor you can add custom column like this

Record.FromList(Text.Split([data], ","), Text.Split([headers], ","))

and then expand the new column

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

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Stachu Super Contributor
Super Contributor

Re: Sorting header and data columns separated by commas

in Query editor you can add custom column like this

Record.FromList(Text.Split([data], ","), Text.Split([headers], ","))

and then expand the new column

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

Proud to be a Datanaut!

View solution in original post

Highlighted
Antiparras Regular Visitor
Regular Visitor

Re: Sorting header and data columns separated by commas

Perfect! Thanks!

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 143 members 1,841 guests
Please welcome our newest community members: