Power Query – Data Transformation: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
== Objective == | == Objective == | ||
Clean and reshape data using Power Query’s built-in tools. | |||
== Files Used == | == Files Used == | ||
Line 10: | Line 10: | ||
== Removing Rows and Columns == | == Removing Rows and Columns == | ||
'''Steps:''' | '''Steps:''' | ||
# | # Load '''Survey_Results.xlsx''' | ||
# In Power Query Editor: | # In Power Query Editor: | ||
#* Go to the '''Home''' tab → '''Remove Rows''' → '''Remove Blank Rows''' | #* Go to the '''Home''' tab → '''Remove Rows''' → '''Remove Blank Rows''' | ||
#* Select | #* Select columns to remove → Right-click → '''Remove Columns''' | ||
== Changing Data Types == | == Changing Data Types == | ||
'''Steps:''' | '''Steps:''' | ||
# Click the icon next to a column header (e.g. ABC123) | # Click the icon next to a column header (e.g. ABC123) | ||
# Choose | # Choose data type (e.g. '''Whole Number''', '''Date''', '''Text''') | ||
# Or: | # Or: '''Transform''' tab → '''Data Type''' | ||
== Renaming Columns == | == Renaming Columns == | ||
'''Steps:''' | '''Steps:''' | ||
# Double-click the column | # Double-click the column name or | ||
# Right-click → '''Rename''' → Type | # Right-click → '''Rename''' → Type new name | ||
== Filtering | == Filtering and Sorting == | ||
'''Steps:''' | '''Steps:''' | ||
# Click | # Click filter icon in column header | ||
# Use | # Use built-in filters or checkboxes | ||
# Click arrow again to access '''Sort Ascending''' / '''Sort Descending''' | |||
# Click | |||
== Grouping Data == | == Grouping Data == | ||
'''Steps:''' | '''Steps:''' | ||
# Go to | # Select a column | ||
# Choose | # Go to '''Transform''' tab → '''Group By''' | ||
# Choose operation: Sum, Count, etc. | |||
== Splitting Columns == | == Splitting Columns == | ||
'''Steps:''' | '''Steps:''' | ||
# Select a column | # Select a column (e.g. Full Name) | ||
# Go to | # Go to '''Home''' tab → '''Split Column''' | ||
# Choose method | # Choose method (e.g. by delimiter) | ||
== Unpivoting Columns == | |||
'''Steps:''' | '''Steps:''' | ||
# | # Load '''Orders_2023.xlsx''' | ||
# Select | # Select month columns (e.g. Jan, Feb) | ||
# Go to | # Go to '''Transform''' tab → '''Unpivot Columns''' | ||
== Reordering Columns == | == Reordering Columns == | ||
'''Steps:''' | '''Steps:''' | ||
# Drag | # Drag columns to new position or | ||
# Right-click | # Right-click column → '''Move''' → choose direction | ||
== Duplicating and Referencing Queries == | == Duplicating and Referencing Queries == | ||
'''Steps:''' | '''Steps:''' | ||
# | # Right-click a query in the left pane | ||
# Choose: | # Choose: | ||
#* '''Duplicate''' – | #* '''Duplicate''' – creates a full copy | ||
#* '''Reference''' – creates a new | #* '''Reference''' – creates a linked copy | ||
== Additional Exercise: Cleanup and Pivot Prep == | |||
'''Goal:''' Prepare survey data for analysis. | |||
'''Steps:''' | |||
# Remove rows with missing satisfaction scores | |||
# Change column names to lowercase | |||
# Group by satisfaction rating and count rows | |||
# Load results into a new sheet | |||
== Extension: Conditional Columns == | |||
'''Goal:''' Create a new column that classifies satisfaction as Positive/Neutral/Negative. | |||
'''Steps:''' | |||
# Go to the '''Add Column''' tab → '''Conditional Column''' | |||
# Name: `SatisfactionLevel` | |||
# Logic: | |||
#* If Satisfaction = 4 or 5 → "Positive" | |||
#* If Satisfaction = 3 → "Neutral" | |||
#* If Satisfaction = 1 or 2 → "Negative" | |||
# Click OK | |||
---- | ---- | ||
→ Continue to [[Power Query – Automation and Parameters|Module 4: Automation and Parameters]] | → Continue to [[Power Query – Automation and Parameters|Module 4: Automation and Parameters]] |
Revision as of 09:45, 19 June 2025
Module 3: Data Transformation Techniques
Objective
Clean and reshape data using Power Query’s built-in tools.
Files Used
Removing Rows and Columns
Steps:
- Load Survey_Results.xlsx
- In Power Query Editor:
- Go to the Home tab → Remove Rows → Remove Blank Rows
- Select columns to remove → Right-click → Remove Columns
Changing Data Types
Steps:
- Click the icon next to a column header (e.g. ABC123)
- Choose data type (e.g. Whole Number, Date, Text)
- Or: Transform tab → Data Type
Renaming Columns
Steps:
- Double-click the column name or
- Right-click → Rename → Type new name
Filtering and Sorting
Steps:
- Click filter icon in column header
- Use built-in filters or checkboxes
- Click arrow again to access Sort Ascending / Sort Descending
Grouping Data
Steps:
- Select a column
- Go to Transform tab → Group By
- Choose operation: Sum, Count, etc.
Splitting Columns
Steps:
- Select a column (e.g. Full Name)
- Go to Home tab → Split Column
- Choose method (e.g. by delimiter)
Unpivoting Columns
Steps:
- Load Orders_2023.xlsx
- Select month columns (e.g. Jan, Feb)
- Go to Transform tab → Unpivot Columns
Reordering Columns
Steps:
- Drag columns to new position or
- Right-click column → Move → choose direction
Duplicating and Referencing Queries
Steps:
- Right-click a query in the left pane
- Choose:
- Duplicate – creates a full copy
- Reference – creates a linked copy
Additional Exercise: Cleanup and Pivot Prep
Goal: Prepare survey data for analysis.
Steps:
- Remove rows with missing satisfaction scores
- Change column names to lowercase
- Group by satisfaction rating and count rows
- Load results into a new sheet
Extension: Conditional Columns
Goal: Create a new column that classifies satisfaction as Positive/Neutral/Negative.
Steps:
- Go to the Add Column tab → Conditional Column
- Name: `SatisfactionLevel`
- Logic:
- If Satisfaction = 4 or 5 → "Positive"
- If Satisfaction = 3 → "Neutral"
- If Satisfaction = 1 or 2 → "Negative"
- Click OK
→ Continue to Module 4: Automation and Parameters
Return to Main Page