Forum Discussion

mterry's avatar
mterry
Helper V
1 year ago
Solved

Merging rows and using row values as both column headers and row values

I have a table that has a column filled with questions, and another column with applicable respoonses to those questions. I'm hoping I can transform this table using Power Query so that each question is a column header and the value in that column is the response. A sample of the table as-is now and what I'd like for it to look like is posted below:

Table now:

CompanyQuestionResponse
AcmeQuestion 1Yes
AcmeQuestion 2No 
AcmeQuestion 350
AcmeQuestion 4Blue

 

My desired result:

CompanyQuestion 1Question 2Question 3Question 4
AcmeYesNo50Blue
  • Just Pivot with no aggregation

     

    Table.Pivot(#"Previous Step", List.Distinct(#"Changed Type"[Question]), "Question", "Response")

     

4 Replies

  • Just Pivot with no aggregation

     

    Table.Pivot(#"Previous Step", List.Distinct(#"Changed Type"[Question]), "Question", "Response")

     

  • Hi mterry , Could you please try this 

    • Select "Company" as the grouping column, "Question" as the column to pivot, and "Response" as the values.
    • Go to the "Transform" tab and click "Pivot Column."
    • In the dialog, set "Values Column" to "Response" and "Column to Pivot" to "Question."
      If this post helped please do give a kudos and accept this as a solution
      Thanks In Advance

     

    • mterry's avatar
      mterry
      Helper V

      Thanks for the response - I didn't get a chance to try as the previous response worked.