How do I pivot headcount from an HR export?
The HR system exports a roster, not a headcount table. 'Active as of period end' is a filter (termination_date empty or after 2026-09-30), and the pivot the business wants is headcount × department × location with average base salary and payroll cost on the side. In Excel that's a filter people forget to re-apply plus a pivot that mangles the salary average. Here it's one question against the export itself.
The hr_roster.csv sample (employee_id…) is registered as a DuckDB table in your browser — the exact engine workspaces use. SQL is always shown.
Running on the sample hr_roster.csv — the question is editable, and the Your own CSV tab registers your file in your browser instead.
How to pivot headcount from an HR export — without the manual grind
The active-heads trap
Rows with a termination date before period end aren't headcount — but they still sit in the export, and every manual pivot that forgets the date filter overstates HC and payroll. The generated SQL encodes the rule once: hire_date ≤ period end AND (termination_date IS NULL OR termination_date > period end).
The pivot, seeded from your question
Group by department and location, COUNT the actives, AVG the base salary, SUM the payroll cost. The demo shows the SQL and the table; in a workspace you also get a one-click pivot builder and a chart seeded from the question's intent.
Compare against the budget plan
Add the budget headcount file and the same question turns into HC vs plan with variance columns — the version Finance actually asked for.
Common questions
What column names does it understand?
Common HR export variants: employee_id/emp_id, department/dept, location/region, hire_date/start_date, termination_date/end_date, base_salary, status. The matcher handles the synonyms so you don't rename columns before asking.
Does my file get uploaded anywhere?
No. The demo registers your file as a DuckDB-WASM virtual table inside your browser tab. It never leaves your machine — which is the same architecture workspaces use, by design, for finance data.
Can I keep the pivot for next month?
Yes — in a workspace the query saves as a re-runnable artifact with a share link. New export, same question, regenerated table.
Run this on your own export, every month
Free workspace: 10 questions/day, files up to 10 MB. Pro $15/mo ($99/yr) for 100 MB. Your files never leave your browser.
client-side by design SQL always shown
More live demos
How do I build a variance vs budget table in Excel?
Skip the SUMIFS rebuild. Drop your GL export, ask for the variance table in plain English, and get working DuckDB SQL pl…
How do I merge ERP exports into my planning model?
ERP exports never match the planning model's keys. Join the GL to your dept map, re-key accounts to planning names, and …