Skip to content
VirtualLP Virtual Learning Platform

Industry Practical: Headcount, Attrition, Snapshots and Regional Access

8 min read Topic 37 of 38 2 hands-on labs

Understand it in simple language

The HR case contains 302 synthetic employees, 2,818 employee-month snapshot rows and a fictional user-to-region map. It includes a joiner on 31 December and an employee whose EndDate is 31 December, so you can test boundary behavior.

The agreed headcount rule is StartDate <= cutoff and (EndDate is blank or EndDate > cutoff). EndDate is the first inactive date, so an employee ending on the cutoff is excluded. Attrition for this exercise is annual leavers divided by the average of opening and closing headcount; real organizations may use a different denominator. Summing monthly snapshots gives employee-months, not ending headcount. Salary values are synthetic and still give you a reason to practise restricted access.

Do it step by step

  1. Download hr.zip. Import Employees.csv, MonthlyHeadcount.csv and SecurityMapping.csv, keeping those query names. Set StartDate, EndDate and SnapshotDate to Date; blanks in EndDate must become null, not an arbitrary future date.
  2. Create or import a Calendar with Date and Year columns. For this as-of exercise keep the cutoff Calendar disconnected from Employees: an active StartDate relationship would exclude people who joined before the selected period. Use Calendar[Date] as a single selected cutoff and Calendar[Year] for annual measures. Use separate date-role designs for joiner/leaver event reports.
  3. Relate Employees[EmployeeID] (1) to MonthlyHeadcount[EmployeeID] (*) with Single direction for employee/region drilldown. Keep snapshot date filtering explicit; do not mix the snapshot count with event-based headcount without agreeing the cutoff.
  4. Create these measures separately:
Headcount = VAR D = MAX('Calendar'[Date]) RETURN COUNTROWS(FILTER(Employees, Employees[StartDate] <= D && (ISBLANK(Employees[EndDate]) || Employees[EndDate] > D)))
Opening Headcount = VAR Y = SELECTEDVALUE('Calendar'[Year], 2025) VAR D = DATE(Y, 1, 1) RETURN COUNTROWS(FILTER(Employees, Employees[StartDate] <= D && (ISBLANK(Employees[EndDate]) || Employees[EndDate] > D)))
Closing Headcount = VAR Y = SELECTEDVALUE('Calendar'[Year], 2025) VAR D = DATE(Y, 12, 31) RETURN COUNTROWS(FILTER(Employees, Employees[StartDate] <= D && (ISBLANK(Employees[EndDate]) || Employees[EndDate] > D)))
Leavers = VAR Y = SELECTEDVALUE('Calendar'[Year], 2025) RETURN COUNTROWS(FILTER(Employees, NOT ISBLANK(Employees[EndDate]) && YEAR(Employees[EndDate]) = Y))
Attrition % = DIVIDE([Leavers], ([Opening Headcount] + [Closing Headcount]) / 2)
  1. Select cutoff 2025-12-31 and year 2025. Verify E0301 is active and E0302 is inactive. Compare headcount with a table of qualifying EmployeeIDs and with the December snapshot. Repeat at 2025-01-01.
  2. Build a department/region headcount report and keep salary detail off the general audience report. Create a Regions dimension and implement the user mapping from the dynamic security lesson. Secure the mapping itself if exposed to consumers. Use fictional Viewer accounts in a permitted training tenant; do not use real employee data.
  3. Complete the headcount, attrition, snapshot and mapped-access labs. Test North-only mapping, an unmapped Viewer returning zero rows, and the difference between Viewer and Member behavior. The browser identities are simulated, not a Microsoft login.
  4. Save test evidence, metric definitions and data-retention/access rules for handover.

Check your result

Opening headcount on 2025-01-01 is 208; closing headcount on 2025-12-31 is 248; 2025 leavers are 20; attrition is 8.7719% under the stated denominator. The December snapshot agrees with 248. The complete 2,818 snapshot rows must not be reported as ending headcount. An unmapped Viewer must receive zero rows.

If something goes wrong

If headcount includes only new joiners, inspect an unintended StartDate relationship or date filter. If December differs by one or two, test inclusive StartDate and exclusive EndDate explicitly. If a blank end date is parsed incorrectly, repair its type/null handling. Test actual service access with a Viewer; editing roles do not prove restricted-reader behavior.

Practice data and learning method

Industry practice collection: downloadable retail, finance, HR and operations datasets, dictionaries, full walkthroughs and answer sheets. The cases contain multiple years, multiple related tables, deliberate data defects and known-answer checks. Progress from the small foundation files below to these cases; do not reuse the foundation totals for the larger datasets.

Download Sales.csv, Products.csv, and the dataset guide. These files contain synthetic training data, not real customers. Use the Power BI virtual labs for guided browser practice. Each lab states its supported operations. Then repeat the procedure above in the actual Microsoft tools and save evidence of your result. Try another filter or an intentionally incorrect setting and explain what changed before moving on.

Guided practicals for this topic

Virtual lab · Microsoft Power BI · 35 min

Compute headcount with joiner and leaver boundaries

Hands-on hr case: load the downloadable CSV tables, perform the actions, inspect the full-data result and reconcile it. Includes a paired Desktop procedure.

Open lab

Virtual lab · Microsoft Power BI · 35 min

Calculate annual attrition with a defined denominator

Hands-on hr case: load the downloadable CSV tables, perform the actions, inspect the full-data result and reconcile it. Includes a paired Desktop procedure.

Open lab

Continue learning from Microsoft

Power BI documentation · DAX reference · Power Query M reference · Power BI analyst skills map. Features, licensing, menus and availability can change; check the relevant official page for your environment.

Practise this topic

Hands-on virtual labs

Apply what you just read in a realistic, guided simulation. Free with a verified account.

Create a free account to track your progress and unlock virtual labs.