Forum Discussion

oliviaspmcf1's avatar
oliviaspmcf1
New Member
5 years ago

Pivot table of multiple columns in PowerQuery

Hi All,

 

I am trying to transform multiple columns of my data set so I can express them all in one dashboard.

 

For the purpose of finding a solution I have simplified what I am trying to do into an example of 'Person' from a certain 'Country' and the 'date' that they bought either a 'Red', 'Green' or 'Yellow' top on.

 

What I am trying to achieve is one dashboard that end users can then filter by top colour to see total amounts of top colours purchased in certain dates, or countries.

 

Currently my data is in this format:

 

IDNameCountryGreenRedBlue
1JohnBrazil7/2/2020  
2GraemeAustralia 7/2/2020 
3RebeccaNew Zealand   
4SarahChile 4/15/2020 
5StephCzech Republic4/14/2020 7/2/2020
6MichaelChile 3/3/2020 
7PabloNew Zealand3/6/2020  
8BartIndia  3/27/2020
9KiranIndia1/9/2020  

 

I am thinking it would be best to use a PivotTable to get it in the form of:

IDNameCountryPivotedColumn?GreenRedBlue
1JohnBrazilGreen7/2/2020  
2GraemeAustralia 7/2/20207/2/2020 
3RebeccaNew Zealand    
4SarahChile  4/15/2020 
5StephCzech RepublicGreen4/14/2020  
5StephCzech RepublicBlue  7/2/2020
6MichaelChileRed 3/3/2020 
7PabloNew ZealandGreen3/6/2020  
8BartIndiaBlue  3/27/2020
9KiranIndiaGreen1/9/2020  

 

When I try to do this, it comes up with "Expression.Error: We cannot apply a Pivot operation over a table that contains columns with nested data. Please remove these columns first"

 

Would anyone please be able to help me with a way to get my data in the right form and visualised how I am visioning?

 

Thanks so much, would appreciate any help!

1 Reply

  • Hi,

    I am not sure of what visual you want to create but as a starting point, you should select the first 3 colums and select "Unpivot Other columns"