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
JamesLeach
Frequent Visitor

Unsure how to combine data

Hello! 

 

I've got some survey results data I'm querying via a web API that is being returned as nested XML, many layers deep.  I'm having some problems with the last, lowest layer.     Here is a visual representation of the information: 

 

image.png

 

 

 

 

 

 

 

 

 

My 'SurveyData' table has the list of response.Ids and a column for each question's response:

response.IdquestionData.1questionData.2question.Data.3
1001[record][record][record]
1002[record][record][record]

 

I can expand each of those records, which is what I've done, but that leaves me with my "Answers" table, a table that looks more or less like this, which just seems wrong...

 

response.Idq1.numberq1.sectionq1.questionTextq1.answerq2.numberq2.sectionq2.questionTextq2.answerq3.numberq3.sectionq3.questionTextq3.answerq4.numberq4.sectionq4.questionTextq4.answer
10011section oneGeneric guestion oneA2section twoGeneric question twoC3section threeGeneric question threeD4section threeGeneric question fourA
10021section oneGeneric guestion oneB2section twoGeneric question twoC3section threeGeneric question threeA4section threeGeneric question fourC
10031section oneGeneric guestion oneA2section twoGeneric question twoD3section threeGeneric question threeA4section threeGeneric question fourC
10041section oneGeneric guestion oneA2section twoGeneric question twoC3section threeGeneric question threeA4section threeGeneric question fourA

 

When what I really want is something more like this:

response.Idquestion.numberquestion.sectionquestion.textquestion.answer
10011section oneGeneric question oneA
10012section twoGeneric question twoC
10013section threeGeneric question threeD
10014section threeGeneric question fourA
10021section oneGeneric question oneB
10022section twoGeneric question twoC
10023section threeGeneric question threeA
10024section threeGeneric question fourC

 

I've already got the question numbers and text in another table so I could leave the question text out but the only place to get the "section" is from the responses.

 

Does anyone have any suggestions for how to accomplish this?

2 REPLIES 2
MFelix
Super User
Super User

Hi @JamesLeach ,

 

What is the connector you are using to open the file? I tried using the XML connector and it opened my test file correctly.

 

Is your XML with the correct output format?

 

Can you share a sample of your file to make some tests?

 

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



It wasn't an issue with opening the data - the XML connector works fine.    The issue was with the deeply nested structure of the XML.   

 

I ended up with a table with an index column and columns containing records for each result.   This was what I was trying to combine.   What did was 'unpivot' all the columns with the records and then expanding the records.   This resolved my issue.

 

I know I did a poor job explaining what I was looking for.  

 

Thank you for trying to help.

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.