Forum Discussion

bgdean94ad's avatar
bgdean94ad
New Member
2 years ago
Solved

Unpivot table with Question, Answer and Reasoning (Multiple Attributes per 1 value)

Hi there, 

 

I am looking for assistance with the following.

 

I have a table that has the following as an example. 

Information 1Information 2Information 3Question 1Question 2Question 3Reasoning 1Reasoning 2Reasoning 3
A123Dogxyzx1y1z1
B123

Dog

x

y

zx2y2z2
C123Dogxyzx3y3z3
A456Dogxyzx1y1z1
B456Dogxyzx2y2z2
C456Dogxyzx3y3z3
A123Catxyzx1y1z1
B123Catxyzx2y2z2
C123Catxyzx3y3z3
A456Catxyzx1y1z1
B456Catxyzx2y2z2
C456Catxyzx3y3

z3

 

I would like to, however, unpivot the columns so that the following is the result. In theory, I would like to unpivot so that I have the Question, the Answer, and the Reasoning behind that answer. I am having an issue with the reasoning, as they unpivot just as any other column would, so how do I make it look like below?

 

Information 1Information 2Information 3QuestionAnswerReasoning
A123DogQ1(value from question 1)(value from reasoning 1)
B123

Dog

Q2

(value from question 2)

(value from reasoning 2)

C123DogQ3(value from question 3)(value from reasoning 3)
A456DogQ1(value from question 1)(value from reasoning 1)
B456Dog

Q2

(value from question 2)

(value from reasoning 2)

C456DogQ3(value from question 3)(value from reasoning 3)
A123CatQ1(value from question 1)(value from reasoning 1)
B123Cat

Q2

(value from question 2)

(value from reasoning 2)

C123CatQ3(value from question 3)(value from reasoning 3)
A456CatQ1(value from question 1)(value from reasoning 1)
B456Cat

Q2

(value from question 2)

(value from reasoning 2)

C456CatQ3(value from question 3)

(value from reasoning 3)