How do I pivot expenses by department from a GL export?
The GL pivot ritual: filter out the revenue accounts, insert a PivotTable, drag departments to columns and accounts to rows, fix the refresh that swallowed two cost centers, format, repeat next month-end. The trap is always the same first step — the revenue rows that inflate "total spend" when someone forgets the filter. The demo below runs the pivot on a sample GL export with the expense filter encoded in the SQL, not in someone's memory.
The gl_expenses.csv sample (period…) is registered as a DuckDB table in your browser — the exact engine workspaces use. SQL is always shown.
Running on the sample gl_expenses.csv — the question is editable, and the Your own CSV tab registers your file in your browser instead.
Sample datagl_expenses.csv
How to pivot expenses by department from a GL export — without the manual grind
The filter people forget, encoded once
The sample GL carries an account_type column; the generated SQL filters to expense-type accounts before the pivot, so revenue can never leak into spend. Expense/Opex/COGS naming variants are detected from your data.
A real pivot, not a screenshot
Accounts as rows, one column per department, total spend per account, biggest first — the conditional-aggregation SQL is shown and editable, so the pivot adapts to your chart of accounts instead of the other way around.
Same pivot next month, one click
In a workspace the query saves as a re-runnable artifact with a share link. New export, same question, regenerated table — the month-end pivot stops being a rebuild.
Common questions
How are revenue accounts excluded?
If your GL export has an account_type (or type/class) column, the SQL filters to the expense-like values it detects — Expense, Opex, COGS all qualify. No type column? The template pivots every account and says so in its note.
What column names does it understand?
Common GL variants: account/account_name/line_item, department/dept/cost_center, account_code, amount/value/balance. The matcher handles the synonyms so you don't rename columns before asking.
Can I keep the table for the board pack?
Yes — copy the table, or save the query as an artifact in a free workspace and re-run it on each month's export. SQL, table and share link stay together.
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 pivot headcount from an HR export?
Stop hand-filtering termination dates in Excel. Ask for the headcount pivot in plain English — active heads by departmen…
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 …
How do I calculate run rate from monthly revenue?
Run rate is the trailing 3-month average × 12 — not last month × 12. Drop your monthly revenue export, ask for the run r…
How do I calculate burn rate and runway?
Net burn = cash out − cash in. Runway = cash balance ÷ average net burn. Run both on your bank-activity CSV in plain Eng…
How do I build a 13-week cash flow forecast?
The weekly cash walk without the workbook: drop your receipts/disbursements export, ask for the 13-week forecast, and ge…
How do I build a rolling forecast in Excel?
A rolling forecast is actuals-to-date plus a re-cut forecast for the rest of the year — closed months lock, open months …