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
JasonMalvor
New Member

Reading XML File

Hello, I have a problem with importing this xml file,

Screenshot 2023-03-23 215121.png

I don't know why but when I tried to upload the xml file, the file looks like a bunch of tables like in the photo above. Then, I tried to expand the data in Power Query Editor and resulted like this:

Screenshot 2023-03-23 215310.png

The data doesn't seem to correspond to the exact column. For example, Aruba and 1960 should be in different columns. This is what the xml file looks like when I opened it in a browser:

Screenshot 2023-03-23 215701.png

Does anyone know how to fix this?

1 ACCEPTED SOLUTION

NewStep=#table(4,List.Split(PreviousStepName[#"field.Element:Text"],4))

View solution in original post

4 REPLIES 4
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1679629517839.png

try to replace the code here with this

=Table.Combine(List.Transform(Table1[field],each Table.AddColumn(#table([#"Attribute:name],{[#"Element:Text"]}),"key",(x)=>Text.Combine([#"Attribute:key"]," - "))))

That still didn't work. But now I think I just transformed the data into like this:

Screenshot 2023-03-24 110715.png

So I just need to turn every 4 rows into just one row. For example, the first row should be Aruba in the first column, Government expenditure...... in the second column, 1960 in the third column, and null in the fourth column. Does anyone know how to do that? I would really appreciate it.

NewStep=#table(4,List.Split(PreviousStepName[#"field.Element:Text"],4))

It worked! Thank you so much.

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.

Top Solution Authors
Top Kudoed Authors