Hello,
Am very new at Alteryx. Thank you for all the help in advance.
I have data that looks like the following:
customer_id | question | answer_chosen |
1 | Q1 | 1 |
2 | Q2 | 5 |
3 | Q3 | 2 |
4 | Q1 | 4 |
5 | Q7 | 3 |
1) I am trying to convert the unique questions into column categories, and 2) replace the row values of the new columns with the respective answer_chosen value, else leave it empty or null, and then 3) append the new columns to the end of the original data set.
Results should look like the following:
customer_id | question | answer_chosen | Q1 | Q2 | Q3 | Q4 | Q5 | Q6 | Q7 |
1 | Q1 | 1 | 1 | ||||||
2 | Q2 | 5 | 5 | ||||||
3 | Q3 | 2 | 2 | ||||||
4 | Q1 | 4 | 1 | ||||||
5 | Q7 | 3 | 3 |
And the real data I have is very massive with more questions than above example.
Could you please help point me in the right direction?
Thanks,
~Sky
Solved! Go to Solution.
You can do this with the Cross Tab tool:
Group by all your fields, select "question" for column headers and "answer_chosen" for values. The only issue I see is if you need to populate those questions that aren't present in the data (Q4-Q6 in your data). Will every question be present in your real data set? If so, this one tool can handle this.
Thank you for the quick reply. And yes, all questions do exist in the data set. I was thinking this was more complex. I did have to group by customer_id, but this did the trick. Thank you!