Here's a practical guideline for Power Query transformations based on common data scenarios:
Data Cleaning Scenarios
Scenario: Inconsistent Text Data
- Use: Trim, Clean, Upper/Lower/Proper Case
- When: Names, addresses, or text fields with extra spaces, mixed capitalization
- Example: " john SMITH " → "John Smith"
Scenario: Missing or Null Values
- Use: Replace Values, Fill Down/Up, Remove Rows
- When: Gaps in data that need standardization
- Example: Replace blank cells with "Unknown" or forward-fill missing dates
Scenario: Inconsistent Data Types
- Use: Change Data Type, Parse (Date/Number)
- When: Numbers stored as text, dates in wrong format
- Example: "123" (text) → 123 (number)
Data Restructuring Scenarios
Scenario: Wide Data Needs to be Tall
- Use: Unpivot Columns
- When: Monthly columns (Jan, Feb, Mar) need to become rows
- Example: Sales by month in columns → Month/Sales in rows
Scenario: Tall Data Needs to be Wide
- Use: Pivot Column
- When: Category values need to become column headers
- Example: Product/Sales rows → Products as columns
Scenario: Single Column Contains Multiple Values
- Use: Split Column (by delimiter, position, or character)
- When: Full names, addresses, or codes in one field
- Example: "John Smith" → "John" | "Smith"
Data Combination Scenarios
Scenario: Combining Multiple Files
- Use: Append Queries
- When: Same structure files (monthly reports, regional data)
- Example: Jan.xlsx + Feb.xlsx + Mar.xlsx
Scenario: Adding Related Information
- Use: Merge Queries (Join)
- When: Need to add lookup data or combine related tables
- Join Types:
- Left Join: Keep all main data, add matching lookup data
- Inner Join: Keep only matching records
- Full Outer: Keep all records from both tables
Data Filtering & Selection Scenarios
Scenario: Remove Irrelevant Records
- Use: Filter Rows
- When: Need specific date ranges, regions, or criteria
- Example: Only 2024 data, only "Completed" orders
Scenario: Remove Unnecessary Columns
- Use: Remove Columns, Choose Columns
- When: Simplifying dataset or removing sensitive data
- Example: Keep only Name, Date, Amount from 20-column file
Scenario: Remove Duplicate Records
- Use: Remove Duplicates
- When: Data quality issues or multiple source consolidation
- Example: Customer list with duplicate entries
Data Enhancement Scenarios
Scenario: Need Calculated Fields
- Use: Add Column (Custom Column)
- When: Mathematical calculations, text concatenation, conditional logic
- Example: Total = Quantity × Price, Full Name = First Name + " " + Last Name
Scenario: Categorizing Data
- Use: Conditional Column
- When: Need to group values into categories
- Example: Sales Amount → "High/Medium/Low" categories
Scenario: Extract Specific Parts of Data
- Use: Extract (Text functions)
- When: Need specific characters, words, or patterns
- Example: Extract year from date, first 3 characters of code
Advanced Scenarios
Scenario: Complex Data Transformation
- Use: Group By
- When: Need aggregated summaries (sums, averages, counts)
- Example: Total sales by customer, average order by region
Scenario: Working with Hierarchical Data
- Use: Expand/Aggregate columns
- When: JSON data, nested tables, or structured data
- Example: Expanding JSON response into flat table
Scenario: Date/Time Manipulation
- Use: Add Date/Time columns
- When: Need specific date parts or calculations
- Example: Extract month, calculate age, find weekday
Performance Best Practices
Early in Process: Filter rows and remove columns first
Data Types: Set correct data types as early as possible
Expensive Operations: Do merges, grouping, and complex calculations later
Query Folding: Keep operations that can push to data source (databases)
Common Workflow Order
- Clean (trim, replace values, fix data types)
- Filter (remove unwanted rows/columns)
- Reshape (pivot/unpivot if needed)
- Enhance (add calculated columns)
- Combine (merge/append with other data)
- Aggregate (group by if needed)
Would you like me to dive deeper into any specific transformation scenario or provide examples for a particular use case you're working with?