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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

how to extract data from an XML field

Hello,

 

I have already worked with xml field, using the add column, extract, then text between delimiters, and it worked fine.

The situation is more complicated with the input data, I have.

 

Imagine that I have a file with let's say ten columns and many rows.

Among the fields, one is an xml field.

 

For example, for row one I have the following Columns

A B C D E F G H I J  and the column F is an Xml Field.

 

This xml field has structure like the following

 L1   M1   N1   O1   P1   Q1   R1  S1 row1 row2 row3..., row18

 

So if I expand this field, at the end I should have something like that.

A1  B1  C1  D1  E1  L1   M1   N1   O1   P1  Q1  R1  S1 row1 G1  H1  I1  J1

A1  B1  C1  D1  E1  L1   M1   N1   O1   P1  Q1  R1  S1 row2 G1  H1  I1  J1

....

A1  B1  C1  D1  E1  L1   M1   N1   O1   P1  Q1  R1  S1 row1 G1  H1  I1  J1

 

Also, row1 has let's say five different fields and value as well so it give, if we expand the row content:

A1  B1  C1  D1  E1  L1   M1   N1   O1   P1  Q1  R1  S1 val11 val12 val13 val14 val15  H1  I1  J1

A1  B1  C1  D1  E1  L1   M1   N1   O1   P1  Q1  R1  S1 val21 val22 val23 val24 val25  H1  I1  J1

...

A1  B1  C1  D1  E1  L1   M1   N1   O1   P1  Q1  R1  S1 val181 val182 val183 val184 val185  H1  I1  J1

 

Now imagine that the second row is A2 B2 C2 D2 E2 F2 G2 H2 I2 J2 and that the F2 xml field contains 10 rows with 5 value each it will give

 

A2  B2  C2  D2  E2  L2   M2   N2   O2   P2  Q2  R2  S2 val11 val12 val13 val14 val15  H2  I2  J2

A2  B2  C2  D2  E2  L2   M2   N2   O2   P2  Q2  R2  S2 val21 val22 val23 val24 val25  H2  I2  J2

...

A2  B2  C2  D2  E2  L2   M2   N2   O2   P2  Q2  R2  S2 val101 val102 val103 val104 val105  H2  I2  J2

 

and so on.

 

How can I use power bi to expand my input file in such manner?

 

Thanks in advance for you help

 

 

 

 

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Generally, about how to expand columns in power query, I would suggest you refer to the third-party blog written by Chirs.

https://blog.crossjoin.co.uk/2014/05/21/expanding-all-columns-in-a-table-in-power-query/

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Generally, about how to expand columns in power query, I would suggest you refer to the third-party blog written by Chirs.

https://blog.crossjoin.co.uk/2014/05/21/expanding-all-columns-in-a-table-in-power-query/

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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.