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
DR1
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
MarcelBeug
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
MarcelBeug
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)

@MarcelBeug 

 

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

 

Thanks!

Anonymous
Not applicable

Saved my day!

Thank you @MarcelBeug

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.