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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
Stachu
Community Champion
Community Champion

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!
Thank you for the kudos 🙂

View solution in original post

2 REPLIES 2
Stachu
Community Champion
Community Champion

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!
Thank you for the kudos 🙂

Anonymous
Not applicable

Perfect! Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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