Forum Discussion
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 1 | Information 2 | Information 3 | Question 1 | Question 2 | Question 3 | Reasoning 1 | Reasoning 2 | Reasoning 3 |
| A | 123 | Dog | x | y | z | x1 | y1 | z1 |
| B | 123 | Dog | x | y | z | x2 | y2 | z2 |
| C | 123 | Dog | x | y | z | x3 | y3 | z3 |
| A | 456 | Dog | x | y | z | x1 | y1 | z1 |
| B | 456 | Dog | x | y | z | x2 | y2 | z2 |
| C | 456 | Dog | x | y | z | x3 | y3 | z3 |
| A | 123 | Cat | x | y | z | x1 | y1 | z1 |
| B | 123 | Cat | x | y | z | x2 | y2 | z2 |
| C | 123 | Cat | x | y | z | x3 | y3 | z3 |
| A | 456 | Cat | x | y | z | x1 | y1 | z1 |
| B | 456 | Cat | x | y | z | x2 | y2 | z2 |
| C | 456 | Cat | x | y | z | x3 | y3 | 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 1 | Information 2 | Information 3 | Question | Answer | Reasoning |
| A | 123 | Dog | Q1 | (value from question 1) | (value from reasoning 1) |
| B | 123 | Dog | Q2 | (value from question 2) | (value from reasoning 2) |
| C | 123 | Dog | Q3 | (value from question 3) | (value from reasoning 3) |
| A | 456 | Dog | Q1 | (value from question 1) | (value from reasoning 1) |
| B | 456 | Dog | Q2 | (value from question 2) | (value from reasoning 2) |
| C | 456 | Dog | Q3 | (value from question 3) | (value from reasoning 3) |
| A | 123 | Cat | Q1 | (value from question 1) | (value from reasoning 1) |
| B | 123 | Cat | Q2 | (value from question 2) | (value from reasoning 2) |
| C | 123 | Cat | Q3 | (value from question 3) | (value from reasoning 3) |
| A | 456 | Cat | Q1 | (value from question 1) | (value from reasoning 1) |
| B | 456 | Cat | Q2 | (value from question 2) | (value from reasoning 2) |
| C | 456 | Cat | Q3 | (value from question 3) | (value from reasoning 3) |
try to combine queswer and reason column before unpivot the table.
pls see the attachmentb below
1 Reply
- ryan_mayuSuper User
try to combine queswer and reason column before unpivot the table.
pls see the attachmentb below