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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
sc20d2
New Member

Parsing XML element values in Power Query

I need to parse some XML with data stored in element values (rather than attributes) in Power Query. This works fine as long as the elements don't have sub-elements as follows:

<people>
    <person id="1" gender="male">
        <name>Joe</name>
    </person>
    <person id="2" gender="female">
        <name>Sally</name>
    </person>
    <person id="3" gender="male">
        <name>Mike</name>
    </person>
</people>

ok.jpg

 

When my element has sub-elements, Power Query assumes the column is a table datatype and ignores the element values (Joe, Sally, and Mike). It forces me to drill down into the table and provides access to the sub-element's attributes (abbreviated name, full name), which is not what I'm interested in.

<people>
    <person id="1" gender="male">
        <name>Joe<type value="abbreviated name" />
        </name>
    </person>
    <person id="2" gender="female">
        <name>Sally<type value="full name" />
        </name>
    </person>
    <person id="3" gender="male">
        <name>Mike<type value="abbreviated name" />
        </name>
    </person>
</people>

nok1.jpg

I don't need the data in the sub-elements, so any advice on removing them, parsing them, or deleting them would be much appreciated. 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @sc20d2 ,

 

Open your query in Advanced Editor then adjust the Source step to change Xml.Tables to Xml.Document.

You'll still need to do a bit of jiggery-pokery to get the data into the shape you need, but this will at least expose all the data elements for use.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @sc20d2 ,

 

Open your query in Advanced Editor then adjust the Source step to change Xml.Tables to Xml.Document.

You'll still need to do a bit of jiggery-pokery to get the data into the shape you need, but this will at least expose all the data elements for use.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Ah, I think I see that now. Thanks very much for the pointer @BA_Pete . That was exactly what I needed! 


No problem, happy to help.

Don't forget to give a thumbs-up on any posts that have helped you ‌‌👍


Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.