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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Steve_AAA
Frequent Visitor

Unpivot Suvey Data from SharePoint List

I have a SharePoint list that has containing survey data - columns like person filling in the survey (Microsoft Form), the date and details. I have a column for each question answer and question comment e.g.

 

NameDateQuestion 1 AnswerQuestion 1 CommentsQuestion 2 AnswerQuestion 2 CommentsQuestion 3 AnswerQuestion 3 CommentsQuestion 4 AnswerQuestion 4 Comments
Mickey Mouse04/10/23Yesexample comment goes here100This area could be better10n/aYesthis is brilliant
Donald Duck25/12/2022No 50sometimes1room for improvementNothis could be better

 

 

How can I unpivot this so that I get a line per question, with an answer and comment column?

 

NameDateQuestionAnswerComment
Mickey Mouse04/10/2023Question 1Yesexample comment goes here
Mickey Mouse04/10/2023Question 2100This area could be better
Mickey Mouse04/10/2023Question 310n/a
Mickey Mouse04/10/2023Question 4Yesthis is brilliant
Donald Duck25/12/2022Question 1No 
Donald Duck25/12/2022Question 250sometimes
Donald Duck25/12/2022Question 31room for improvement
Donald Duck25/12/2022Question 4Nothis could be better
5 REPLIES 5
christinepayton
Super User
Super User

Hold control and select the first two columns, right click, then "unpivot other columns". Then split the "Attribute" column on something that will split that last word into its own column (the answer/comment word) - I split on number of characters, since the position is always in the same place in the example. 

 

That will put the question number in one column and Answer/Comment label in another. Then Pivot that Answer/Comment column again, choosing "do not aggregate" under advanced and the values column for the values dropdown. That will make Answer/Comment into separate columns and pivot the values under them:

 

christinepayton_0-1696439181814.png

mussaenda
Super User
Super User

Hi @Steve_AAA 

mussaenda_0-1696428324886.png

 

 

mlsx4
Memorable Member
Memorable Member

Hi @Steve_AAA 

 

Assuming your data is in this way (it is not very clear in your explanation):

mlsx4_0-1696421736499.png

You just have to select Type column and go to Transform > Pivot column

And then, you pivot over Answer and in advanced options: not summarize

I've amended my original message to make things clearer. I currently have one row per survey response, but I want to have a row per question of the survey response, with a question, answer and comment column for each. I am using the unpivot function for just question and answer at the moment, but there is a new requirement to add comment to each line, so I am trying to amend the logic. 

Okey, @Steve_AAA I have it clearer now.

 

Then you need to include previous steps to the ones I have told you before.

 

1) Select Name and date and unpivot other columns

2) You will get two columns called Attribute and Value

3) Split Attribute by delimeter (space) but the most on the right

4) Rename your columns to Question, Type and Value

5) Then, Pivot column as I told you before.

 

If you have some doubt, please write me back

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.