Power Query + Power Pivot Sales Pipeline
A repeatable Excel reporting pipeline for a fictional coffee chain. Power Query combines and cleans 12 monthly till exports from a folder, Power Pivot models them with DAX, and a report of PivotCharts, slicers and CUBEVALUE tiles updates with one Refresh All.

The problem
Many teams still build their monthly report by copying 12 exports into one sheet by hand. It’s slow, and every month it’s a chance to paste the wrong file. The fix is a pipeline: drop the new file in a folder, click Refresh All, and the report updates.
Copperleaf Coffee is a fictional chain of 8 coffee shops across the UK. Its till system exports one CSV per month. The files have the usual problems:
- transactions from a
TESTtill - blank product lines
- refunds (quantity ≤ 0)
- product names with trailing spaces
- lower-case store IDs
- a new
PromoCodecolumn that appears from July
How it works
Power Query (M):
- A
FolderPathparameter points at the data folder, so the workbook runs on any PC. Folder.Fileslists the folder and keeps onlySales_*.csv, so stray files are ignored.- Each file is parsed and the files are stacked with
Table.Combine, which lines columns up by name, so the July schema change simply adds a column. - Data types are set with the
en-USlocale, so dates and decimals parse the same anywhere. - Product names are trimmed, store IDs upper-cased, and blank promo codes labelled “None”.
- TEST, blank and refund rows are filtered out.
Date,HourandAmountcolumns are derived.- A separate FileLog query counts, for each file, the raw rows, what was removed and why, and whether the PromoCode column is present.
Data model (Power Pivot):
- The Sales fact table is loaded to the model only, with no worksheet copy.
- Stores, Products and a Calendar generated in M are linked in a star schema.
- 12 DAX measures: Revenue, COGS (
SUMXwithRELATEDunit cost), Gross Margin %, Transactions (DISTINCTCOUNT), Avg Ticket, Items per Ticket, Revenue PM and MoM % (DATEADD), Revenue per Store Day, Category Share (ALL) and Promo Lines %.
Report:
- Four slicers (region, store type, category, quarter) control everything on the page.
- Six KPI tiles use
CUBEVALUEformulas tied to the slicers. - Four PivotCharts and a store scorecard PivotTable read straight from the data model.
What’s in the workbook
Report: the slicers, CUBEVALUE tiles, four PivotCharts and the store scorecard.
Data Quality: the FileLog table, one row per source file.

Pipeline: documentation of the source files, every Power Query step, the data model, all 12 DAX measures and the full M code.

Pivots: the PivotTables behind the charts, plus a monthly detail table with margin, ticket size and month-on-month change.

Checking it
The source files were generated with a known answer. After a full refresh the model matches it exactly:
- revenue £569,648.33
- 94,104 transactions
- 147,594 clean rows
- gross margin 78.77%
- rows removed: 52 TEST, 27 blank and 45 refunds
Filtering the North region gives the same figure as the answer key.
Key insights
- Coffee is 52% of revenue (£296,442); bakery is next at £87,275.
- The 8am rush is the busiest hour (13,942 transactions), with a second peak at lunch.
- Fridays take the most per store (£211 a day) and Sundays the least (£153).
- Manchester Central Station is the top store (£94,728); Nottingham Canal Street is lowest (£49,949).
- The average ticket is £6.05 with 1.73 items per receipt.
📦 Download the pipeline (.zip): the workbook, the 14 source CSV files and a README. Point the FolderPath parameter at the unzipped Data folder and choose Refresh All. Needs Excel for Windows with Power Pivot.