Power Query Editor 3 different features of it on Employee Data

Sample Dataset: Employee Work Hours (Synthetic)

EmployeeIDNameDepartmentDateCheckInTimeCheckOutTimeLocation
E001AliceHR2024-06-0109:1517:45New York
E002BobFinance2024-06-0109:3018:00Chicago
E003CharlieIT2024-06-0110:0019:00San Francisco
E004DianaHR2024-06-0109:0017:00New York
E005EdwardIT2024-06-0111:0020:00Chicago

Here’s a mini tutorial on Power Query Editor usage in Power BI, covering 3 different features (other than basic formatting), using a sample dataset.



🔧 3 Useful Power Query Editor Features (Beyond Basic Formatting)


1. 🧮 Create a Custom Column (Duration Calculation)

Objective: Calculate total hours worked by each employee.

Steps:

  • Go to Add ColumnCustom Column
  • Use formula: Duration.TotalHours(Time.From([CheckOutTime]) - Time.From([CheckInTime]))
  • Name the column as HoursWorked

Result: A new column with the number of hours each employee worked that day.


2. 🧹 Remove Duplicates

Objective: Clean data by removing duplicate entries based on EmployeeID and Date.

Steps:

  • Select both columns: EmployeeID and Date
  • Go to HomeRemove RowsRemove Duplicates

When to Use: If your dataset has duplicate clock-in/out records for the same employee on the same day.


3. 🔄 Pivot Column

Objective: Transform data to show each employee’s total hours by location.

Steps:

  • First, ensure you’ve added the HoursWorked column.
  • Go to TransformPivot Column
  • Choose Location as the column to pivot.
  • Use HoursWorked as the values column and select “Sum” as the aggregation.

Result: You’ll get one row per employee with columns like New York, Chicago, San Francisco, showing the sum of hours worked at each location.


📘 Summary Table of Features

FeaturePurposeWhere to Find
Custom ColumnAdd calculated logicAdd Column → Custom Column
Remove DuplicatesData cleaningHome → Remove Rows → Duplicates
Pivot ColumnReshape tabular dataTransform → Pivot Column