cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

XML Query Column which contains both "Table" and "Records"

The Column "SINGLE_ROOM_AREA" contains "Table" and values. But the tables only contain one value. How do I get this values expanded?

xml_powerquery2.PNGxml_powerquery.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Champion
Community Champion

You can transform the column like in the second step of this query:

 

let
    Source = #table({"SINGLE_ROOM_AREA"},{{"150"},{#table(type table[#"Element:text" = text],{{"51"}})}}),
    Transformed = Table.TransformColumns(Source, {{"SINGLE_ROOM_AREA", each if _ is table then Table.FirstValue(_) else _}})
in
    Transformed
Specializing in Power Query Formula Language (M)

View solution in original post

4 REPLIES 4
Community Champion
Community Champion

You can transform the column like in the second step of this query:

 

let
    Source = #table({"SINGLE_ROOM_AREA"},{{"150"},{#table(type table[#"Element:text" = text],{{"51"}})}}),
    Transformed = Table.TransformColumns(Source, {{"SINGLE_ROOM_AREA", each if _ is table then Table.FirstValue(_) else _}})
in
    Transformed
Specializing in Power Query Formula Language (M)

View solution in original post

Thank you @MarcelBeug

Anonymous
Not applicable

Saved my day!

@MarcelBeug 

 

What if I need to get all the data not just the first one?

 

Thanks!

Helpful resources

Announcements
November Update

Check it Out!

Click here to read more about the November 2020 Updates!

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform October Community Highlights

Check out the top community contributors across all of the communities

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors