Locked lesson.
About this lesson
While we can use PivotTables to pivot data, occasionally we need to pivot our data in the data preparation phase. This lesson exposes how the Pivot functionality works in Power Query.
Exercise files
Download this lesson’s related exercise files. You can download source data files for the course from the resources section of your Lessons page.
Pivoting Data.xlsx22.7 KB Pivoting Data - Completed.xlsx
30.4 KB
Quick reference
Pivoting Data
An overview of pivoting data in a table.
When to use
When you need to pivot your data before landing it in a worksheet.
Instructions
Getting started
- Create a new query to bring your data to Power Query
Pivoting while aggregating values
- Highlight the column that you want to use for new column headings
- Go to Transform --> Pivot Column
- Choose the column that contains the data you would like to aggregate --> OK
Pivoting without aggregating (preserving original values)
- Highlight the column that you want to use for new column headings
- Go to Transform --> Pivot Column
- Choose the column that contains the data you would like to see in the values area
- Select Advanced Options --> Don’t Aggregate --> OK
Finishing the query
- Apply transformations as required
- Set data type for each column
- Rename the query
- Close & Load the query
Hints & tips
- The Aggregate Value Functions available in the Advanced Options menu include:
- Count all records (the default function)
- Count all non-blank records
- Minimum value
- Maximum value
- Median value
Lesson notes are only available for subscribers.