I build the tools, not just the reports.
I’m a Business Analyst who turns large, messy commercial datasets into automated reporting and clear, actionable insight. Most of my work starts with a recurring manual task, such as a weekly reconciliation, a monthly review or a planning spreadsheet, and ends with a tool that does it reliably in one run.

- Qlik Sense
- Set analysis
- Python
- pandas
- OR-Tools
- OSRM
- openpyxl
- xlsxwriter
- Excel
- VBA
- Pivot tables
- SAP exports
- Power BI
- SQL
- Dynamic programming
- Forecasting
- Built
- 9end-to-end tools, each replacing a manual job
- Platforms
- 3Qlik Sense, Python and Excel/VBA
- Scale
- 138k+transaction rows behind one dashboard
- Education
- BComEconomics, University of Pretoria
Nine tools, each built to replace a manual job.
Each case study walks through the problem, what I built, how it works, the code that matters and what changed. Every screenshot is rebuilt on synthetic data.

Sales Performance Dashboard
One Qlik sheet that behaves like fifty static reports, built from 138,000+ rows of raw transactions.
Read case study
Automated Reporting Suite
Retailer reviews generated from the live Qlik model, in a workbook where one dropdown re-filters every pivot.
Read case study
Multi-Day Call-Cycle Optimiser
Plans a rep’s full territory into a multi-week cycle, deciding when an overnight stay beats driving home.
Read case study
Replenishment Order Audit
Finds duplicate purchase orders and stock pushed into stores that already have months of cover.
Read case study
QSR Monthly Review Generator
An eight-sheet monthly client review built from raw till data, with charts beside every table, month pickers and a slicer, and a written read of each sheet. Every line is compared with its prior three-month average and the same month last year.
Read case study
Service-Level Report & Escalation Email
Splits every lost case by where it was lost, checks it against real stock, and drafts the escalation email by owner.
Read case study
Production Planning Engine
Builds the monthly production plan and the customer pallet orders from four channels’ stock and sales reports, and documents every formula fault it fixed.
Read case study
Store Stock Count Report
Turns weekly in-store stock counts into one line of priorities: phantom stock, big variances, short-dated stock.
Read case study
Range Health & Activation Uplift
Finds every store where a listed product is not selling, and measures whether in-store activations moved it.
Read case study
Sales Performance Dashboard
- Qlik Sense
- Qlik Sense
- Data Modelling
- Set Analysis
- QVD
One Qlik sheet that behaves like fifty static reports, built from 138,000+ rows of raw transactions.
The problem
Commercial teams were working from a library of static reports: one per retailer, per measure, per period. Each answered a single question, none of them agreed perfectly with the others, and every new question meant building another report.
Underneath sat a raw transactional extract of more than 138,000 rows across 37 columns, with no calendar logic and no consistent way to compare this year with last year or this month with the same month a year ago.
What I built
An end-to-end Qlik Sense dashboard built from 138,000+ rows of raw transactional data: custom extract layer, data model, financial-year calendar logic and every expression built from scratch. One control set switches every KPI, chart and title between Volume, Value and Store Count across YTD, financial year, month-to-date or any custom date range.
- Extract layer
The raw transactions are loaded through a custom extract into QVD files, so reloads are fast and the model always reads a clean, typed source.
- Data model
Transactions are linked to customer, region, product, factory and rep dimensions, so any field on screen can filter every chart.
- Calendar
An auto-generated date spine carries financial-year logic (the year starts on 1 March) and pre-computed YTD, MTD, FYTD and prior-year flags.
- Variables
The active measure (Value, Volume or Store Count) and the active period (YTD, FY, MTD or a custom range) live in variables that every expression reads.
- Dynamic titles
A single expression writes every chart heading from the current selections, so the labels can never disagree with the numbers.
=If(GetSelectedCount([Customer])>0,
GetFieldSelections([Customer]) & ' - ',
If(GetSelectedCount([Region])>0,
GetFieldSelections([Region]) & ' - ',
'All Customers - '
)
) & Pick(Match($(vMeasure),'Value','Volume','Store Count'),
If(vPeriod='''Custom''', Date(vStartDate,'DD/MM/YY') & ' - ' & Date(vEndDate,'DD/MM/YY'),
PurgeChar(vPeriod,'''')) & ' Sales Value (R)',
If(vPeriod='''Custom''', Date(vStartDate,'DD/MM/YY') & ' - ' & Date(vEndDate,'DD/MM/YY'),
PurgeChar(vPeriod,'''')) & ' Sales Volume (KG)',
If(vPeriod='''Custom''', Date(vStartDate,'DD/MM/YY') & ' - ' & Date(vEndDate,'DD/MM/YY'),
PurgeChar(vPeriod,'''')) & ' Store Count')Left Join (Calendar)
Load *,
If(Year(Date)=Year(Date($(vMaxDate))) and Date<=Date($(vMaxDate)),1,0) as YTD,
If(Year(Date)=Year(Date($(vMaxDate)))-1 and Month(Date)=Month(Date($(vMaxDate)))
and Day(Date)<=Day(Date($(vMaxDate))),1,0) as LastMTD,
If(Date>=MakeDate(If(Month(Date($(vMaxDate)))<3,Year(Date($(vMaxDate)))-1,
Year(Date($(vMaxDate)))),3,1) and Date<=Date($(vMaxDate)),1,0) as FYYTD
Resident Calendar;Why it matters
- Nothing on this sheet is static. Titles, measures and periods are all variable-driven expressions. One sheet behaves like fifty pre-built reports, and the date intelligence (year-on-year, MTD, FYTD) is computed once at load time so every chart inherits it for free.
Result
- 138,000+ rows of raw transactions turned into one sheet that replaces a library of static reports.
- Any retailer, region, product or rep view is one click away, with year-on-year comparisons built in.
- Every chart shares one set of date flags, so figures agree across the whole page.
Automated Reporting Suite
- Qlik → Excel + VBA
- Qlik Reporting
- Excel
- VBA
- Pivot Automation
Retailer reviews generated from the live Qlik model, in a workbook where one dropdown re-filters every pivot.
The problem
Quarterly retailer reviews and a long list of recurring weekly and monthly reports were produced by hand: export from the BI tool, paste into Excel, rebuild the pivots, format, then email. The same workbook was effectively rebuilt once per retailer.
Every manual step was a chance for a figure to drift, and the time went into production instead of reading the numbers.
What I built
Quarterly retailer reviews generated from the Qlik data model into formatted Excel and distributed on a click. The workbook itself is interactive: one dropdown re-filters every pivot table on every sheet simultaneously via VBA, so one file behaves like a separate report per retailer. Similar automated reporting runs monthly for QSR clients from raw point-of-sale data.
- Template on the live model
Report templates are bound to the Qlik app, so every output is generated from the current data, never from a pasted copy.
- Scheduled distribution
Reports go to the stakeholder list on a schedule or on demand, with no manual export step.
- One source sheet
Every pivot in the workbook reads the same source sheet, so the summary, regional detail and store counts always reconcile.
- One control
A validated dropdown in cell B4 holds the selected retailer.
- Workbook-wide macro
A Worksheet_Change event walks every pivot table on every sheet and aligns its filter to the selection, with smaller accounts grouped under ‘Other’.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$4" Then
Dim selectedValue As String: selectedValue = Target.Value
Dim otherList As Variant
otherList = Array("RETAILER 1", "RETAILER 2", "RETAILER 3", _
"RETAILER 4", "RETAILER 5", "RETAILER 6", "OTHER")
For Each ws In ThisWorkbook.Worksheets
For Each pt In ws.PivotTables
For Each pf In pt.RowFields
If pf.Name = "Sub Customer" Then
pf.ClearAllFilters
For Each pi In pf.PivotItems
If selectedValue = "OTHER" Then
pi.Visible = IsInArray(pi.Name, otherList)
Else
pi.Visible = (pi.Name = selectedValue)
End If
Next pi
End If
Next pf
Next pt
Next ws
End If
End SubWhy it matters
- The macro is field-agnostic and workbook-wide. A single cell change walks every pivot on every sheet and aligns it to the selection, including a grouped ‘Other’ bucket. Non-technical users get a multi-retailer interactive report with zero training, and distribution is one click from the live Qlik model.
Result
- 25 monthly and 13 weekly reports automated.
- Several days of manual report production removed every month.
- One interactive file replaces a separate workbook per retailer.
Multi-Day Call-Cycle Optimiser
- Python + OR-Tools + OSRM
- Python
- Google OR-Tools
- OSRM
- Clustering
- Dynamic Programming
Plans a rep’s full territory into a multi-week cycle, deciding when an overnight stay beats driving home.
The problem
A field rep covers a territory of around 300 stores, from dense metro clusters to towns several hours’ drive away. Call cycles were planned by hand.
Manual plans meant long empty drives, small towns split across different days and revisited later, and no principled way to decide when a hotel night was worth paying for.
What I built
A planner that turns a store list into a complete call cycle: which stores on which day, in what order, whether the rep goes home or stays out, and which far-away stores roll to the next cycle. Road times come from a self-hosted OSRM routing server, and the day-building runs on Google OR-Tools.
How it evolved
The first version built one giant tour through every store, then a dynamic programme split that tour into days, pricing ‘drive home’ against ‘sleep near the last stop’ for every possible day. That split is provably optimal for a given tour, and on a 28-store test it produced a clean four-day plan of 722.9 km with every day inside the 9-hour cap.
At full-territory scale the tour itself became the problem: the split landed wherever the line happened to be, so a town could be cut in half and revisited days later, and about fifteen tuning constants existed only to patch that. The rewrite plans in the right order instead. Decide what is far first, build the overnight trips, then partition everything else into home days.
- Matrix
Real road time and distance between every pair of stores, from a self-hosted OSRM server, cached against a hash of the coordinates.
- Towns and classify
Stores a few minutes apart are welded into towns. Each town or lone store is then either day-reachable from home or ‘far’ (more than 105 minutes one way), and far stores are only ever visited on an overnight trip.
- Trips
Far stores are clustered into regional swings. The night budget is spent on the swings that save the most driving per night, and the rest are deferred whole to the next cycle.
- Corridor
Day-reachable stores that sit on the drive out or back are folded onto a trip, so the long commute is never driven empty.
- Partition
One OR-Tools vehicle-routing solve splits the remaining stores into home days, each inside the work window.
- Repair and polish
Split towns are pulled back onto one day, a home day may not span two unrelated areas, thin days are merged where they fit, and a local pass moves a store to a neighbouring day when that cuts total driving.
- Schedule and export
Swings are spread between runs of home days, each day’s stop order is optimised, and the workbook gets a summary with flags for outlier or over-window days, a tab per day, and a list of stores deferred to the next cycle.
def is_far(s, time_mat):
one_way = time_mat[0][s] # minutes from home
return (one_way > DAYTRIP_MAX_ONEWAY # 105 min: never day-tripped
or 2 * one_way + SERVICE_TIME > WORK_BUDGET)
def town_is_far(group, time_mat):
# a town (stores a few minutes apart) is classified as ONE unit
near_edge = min(time_mat[0][s] for s in group)
if near_edge > DAYTRIP_MAX_ONEWAY:
return True
far_share = sum(is_far(s, time_mat) for s in group) / len(group)
return far_share >= TOWN_FAR_FRACTION # half far -> whole town on a swingdef trip_saving_per_night(cluster, day_dicts, nights, time_mat):
# drive saved by touring the belt vs day-tripping every store from home
as_daytrips = sum(2 * time_mat[0][s] for s in cluster)
saved = as_daytrips - trip_drive(day_dicts, time_mat)
return saved, saved / max(nights, 1)
scored.sort(key=lambda x: x["per_night"], reverse=True) # best value first
for sc in scored:
if sc["per_night"] < HOTEL_MIN_SAVING_PER_NIGHT: # < 60 min saved/night
stay_out_next += sc["belt"]; continue
if sc["nights"] <= NIGHT_BUDGET - used:
trips.append(sc["days"]); used += sc["nights"]
else: # fund the home-anchored prefix,
... # queue the tail wholerouting.SetArcCostEvaluatorOfAllVehicles(drive)
routing.SetFixedCostOfAllVehicles(DAY_FIXED_COST) # opening a day is expensive -> fuller days
routing.AddDimension(drive, 0, DAY_MAX_DRIVE, True, "Drive") # pure driving ceiling
def work_cb(a, b): # drive + 36 min service per store
i, j = manager.IndexToNode(a), manager.IndexToNode(b)
return int(round(sub[i][j])) + (SERVICE_TIME if j != 0 else 0)
routing.AddDimension(routing.RegisterTransitCallback(work_cb), 0, WORK_BUDGET, True, "Work")
for k in range(1, n): # a store that cannot fit is dropped
routing.AddDisjunction([manager.NodeToIndex(k)], DAY_DROP_PENALTY) # ...and deferredB = OSRM_TABLE_BLOCK # 45 -> at most 90 coords per request,
blocks = [list(range(s, min(s + B, n))) for s in range(0, n, B)] # under OSRM's default 100
for bi in blocks:
for bj in blocks:
idx = bi if bi is bj else bi + bj
coords = ";".join(f"{nodes[k][2]},{nodes[k][1]}" for k in idx)
r = requests.get(f"{OSRM_BASE_URL}/table/v1/driving/{coords}",
params={"sources": src, "destinations": dst,
"annotations": "duration,distance"}, timeout=OSRM_TIMEOUT_S)
sub_dur = np.array(r.json()["durations"], float) / 60.0 # s -> min
sub_dist = np.array(r.json()["distances"], float) / 1000.0 # m -> km
# ...pasted into the full matrix, then cached by a hash of the coordinatesWhy it matters
- The overnight decision is economic. A night is only funded if it saves at least 60 minutes of driving compared with day-tripping the same stores, and the cycle has a hard cap on total hotel nights.
- Towns are never split. Stores within a few minutes of each other are welded into one unit before any day is built.
- The routing server is self-hosted OSRM. That removes per-request API costs entirely, and chunked requests get past the default coordinate limit, so the matrix can be any size at zero spend.
Result
- Full-territory run: 239 of 301 stores planned into a 27-day cycle, 5,355 km, with all 8 budgeted hotel nights used and every day inside its working window.
- The remaining 62 far stores are listed belt by belt for the next cycle, not dropped silently.
- Verified first-version run: 28 stores, 4 days, 722.9 km, every day inside the 9-hour cap.
Replenishment Order Audit
- Python
- Python
- pandas
- openpyxl
- SAP exports
Finds duplicate purchase orders and stock pushed into stores that already have months of cover.
The problem
Auto-replenishment was raising duplicate purchase orders and pushing stock into stores already holding weeks of cover. Order volumes made manual checking impossible, so nobody could say how often it happened, where, or on which products.
What I built
This audit ingests a month of daily order reports and stock-on-hand snapshots, de-duplicates PO lines across snapshots, and flags duplicate live POs, orders into stores above 30/60/90 days’ cover, dead stock, and repeat-offender stores, all into a colour-flagged workbook ready for the supplier conversation.
- Parse the exports
Each daily SAP export is read by locating its header row and columns by name, so layout drift does not break the run.
- De-duplicate snapshots
The same PO appears in many daily reports. Lines are keyed on PO, store, product and delivery date, and the latest status wins.
- Find live duplicates
Two live POs for the same store, product and delivery date form a duplicate group. A dropped PO (confirmed = 0) that was legitimately re-raised does not.
- Judge cover on the day
Each order is matched to the stock snapshot from its own raising date, and days of cover come from stock on hand divided by the daily rate of sale.
- Flag and summarise
Orders into stores above 30, 60 or 90 days’ cover, dead stock (stock on hand, zero sales) and stores over-supplied on two or more dates go into a colour-flagged workbook.
hrow = next(i for i, r in enumerate(rows)
if r and any(str(c).strip() == "P.O Number" for c in r))
qrow = hrow - 1 # quantity labels sit one row ABOVE the header in this export
H = [str(c).strip() for c in rows[hrow]] # find every column by name,
Q = [str(c).strip() for c in rows[qrow]] # never by fixed positionseen[(ln['po'], ln['store'], ln['mat'], ln['deliv'])] = ln # latest status wins
def is_live(ln):
return (ln['conf'] or 0) > 0 # dropped POs don't count...
# ...so a legitimate re-raise of a dropped order is NOT flagged;
# two LIVE POs for the same store + product + delivery date ARE.Why it matters
- Two details show judgement, not just code. A PO that was dropped (confirmed = 0) and legitimately re-raised is deliberately not flagged as a duplicate, because the audit understands the process it is checking. And each order is judged against the stock snapshot from its own raising date, not today’s stock, so the flag reflects what the system knew when it ordered.
Result
- A control that did not previously exist: order volumes had made manual checking impossible.
- A month of orders audited in one run, with duplicates, over-supply tiered at 30, 60 and 90 days' cover, dead stock and repeat-offender stores in one workbook.
- Findings arrive as a workbook ready for the supplier conversation.
QSR Monthly Review Generator
- Python
- Python
- pandas
- xlsxwriter
- POS data
An eight-sheet monthly client review built from raw till data, with charts beside every table, month pickers and a slicer, and a written read of each sheet. Every line is compared with its prior three-month average and the same month last year.
The problem
A quick-service restaurant client needed a monthly trading review: what sold, through which channel, on which days and at which hours, and whether the month’s specials actually worked.
The till system exports one wide sheet with a column per date, so every review meant hours of reshaping and pivoting before any analysis could start. A single month-on-month comparison also misled: one unusual month made everything after it look like growth or decline.
What I built
One script turns the raw point-of-sale PLU export into an eight-sheet review. It finds the review month on its own and compares every figure two ways: against the average of the prior three months, for the recent run-rate, and against the same month last year, for seasonality. It covers headline units and main meals by channel, category and product tables with a comparison chart for each, a 13-month trend, day-of-week and hour-of-day patterns, and a specials sheet where each promotion is judged only against its own history. The finished workbook then gets its interactive layer and its written analysis: a category slicer on the trend, Choose Month pickers on the daily and hourly sheets, and commentary beside the tables on every main sheet.
- Reshape
The wide till export is checked for its essential columns, then melted into one row per product, per day, per hour.
- Clean names
Till PLU names are mapped to clean menu names and categories. A new special only needs one line added to the category lookup to appear on the specials sheet.
- Channel
Every sale is classified as instore or delivery from keywords in its till description.
- Pick the periods
The review month is the latest complete month in the export. A part-month is skipped automatically, and the prior three months and the same month last year follow from it. A one-line override exists for re-runs.
- Compare honestly
Where a product has no sales history in a comparison period the cell is left blank, not zero, so a new menu line never shows a fake +100% or −100%.
- Patterns
Day-of-week and hour-of-day sheets compare each slot’s share of units across the three periods, followed by month-by-month blocks for the last 13 months.
- Write
An eight-sheet workbook with a native Excel comparison chart beside every category table, red and green variance formatting and frozen headers, named for the month it covers.
- Make it interactive
A Category slicer filters the monthly trend and its chart. On the daily and hourly sheets a Choose Month list picks any of the last 13 months; MATCH finds its position and INDEX(CHOOSE(...)) pulls that month’s block into the chart.
- Write the read
Each main sheet gets written commentary beside its tables: what moved, by how much against both baselines, and where to look next.
def resolve_periods(df):
if REVIEW_MONTH: # optional override, e.g. "2026-08"
cm = pd.Period(REVIEW_MONTH, "M")
else:
# date columns in the export are the true coverage
max_date = df.attrs.get("last_date", df["Date"].max())
cm = max_date.to_period("M")
if max_date.normalize() < cm.end_time.normalize():
cm -= 1 # latest month isn't complete yet
ly = cm - 12
prior = [cm - i for i in range(PRIOR_MONTHS, 0, -1)]
return cm, ly, priordef compare_by(df, key, cm, ly, prior):
# returns key | CM | LY | 3M Avg (units)
cur = df[df["Month"] == cm].groupby(key)["Units"].sum()
last = df[df["Month"] == ly].groupby(key)["Units"].sum()
p3 = df[df["Month"].isin(prior)].groupby(key)["Units"].sum() / len(prior)
# no fillna: a blank means no sales history in that period
return pd.concat({"CM": cur, "LY": last, "P3M": p3}, axis=1)
def pct(a, b):
if b is None or pd.isna(b) or b == 0:
return np.nan # written as a blank cell, not 0%
return (a - b) / bdef specials_table(df, channel, cm, ly, prior):
d = df[df["Channel"] == channel]
comp = compare_by(d[d["Category"].isin(SPECIAL_CATEGORIES)],
"MappedProduct", cm, ly, prior)
comp = comp[comp.fillna(0).abs().sum(axis=1) > 0]
comp = comp.sort_values(["CM", "P3M"], ascending=False, na_position="last")
return [(clean_special_name(p), r["CM"], r["P3M"], r["LY"])
for p, r in comp.iterrows()]Why it matters
- Two baselines on every line. The three-month average shows whether something is moving now; last year shows whether it is just the season.
- Blanks mean something. ‘No history’ is kept apart from ‘sold nothing’, which stops new lines and specials distorting the growth figures.
- Nothing to edit between runs. The script reads the dates from the export itself and works out which month it is reviewing, including when the latest month is still partial.
Result
- An eight-sheet client review produced by one script run each month, finished with pickers, a slicer and written analysis.
- Every figure read against both the recent run-rate and the same month last year.
- Specials and new lines judged on their own history, with blanks instead of misleading percentages.
Service-Level Report & Escalation Email
- Python
- Python
- pandas
- openpyxl
- HTML email
Splits every lost case by where it was lost, checks it against real stock, and drafts the escalation email by owner.
The problem
Every week some ordered cases never reach the shelf. They are lost at different points: rejected by the retailer’s ordering system (EDI), dropped at order confirmation, short-picked at the warehouse, or lost in transit. Each cause has a different owner, and the raw weekly extract mixes them all together.
The hardest question was whether a confirmation drop happened because there was no stock, which is a planning problem, or despite stock being available, which is a system or logistics failure. Answering it meant cross-checking fourteen daily stock files by hand.
What I built
A weekly script that splits every lost case by where in the order chain it was lost, checks each confirmation drop against the stock that was actually available that day, writes a three-tab report, and drafts one consolidated escalation email grouped by owner, in plain text and Outlook-ready HTML, plus a raw breakdown file.
- Load the extract
The weekly order extract is cleaned and every quantity column coerced to numbers.
- Split the losses
Three loss stages come from the order waterfall (final order vs confirmed, confirmed vs dispatched, dispatched vs delivered) alongside EDI rejections. Total loss is measured from the original order.
- Read the stock files
Fourteen daily stock files (two systems, seven days) are read, or found automatically by their contents. The date is taken from inside each file, and duplicates keep the larger Available Stock figure.
- Judge each drop
Stock is a shared pool, so each confirmation drop is judged per warehouse, product and delivery date against stock on that day or the day before.
- Write the report
An executive summary with contribution data bars, a store loss breakdown per warehouse, and a warehouse × product × store × PO matrix with the stock verdict on every drop.
- Route the escalations
EDI rejections go to the right team per retailer, with unrecognised chains listed for manual routing. Drops with stock go to logistics with a 48-hour feedback window, and drops without stock go to supply planning.
df["DSL Qty Loss"] = df["Final Order Qty"] - df["Confirmed Qty"]
df["BSL Qty Loss"] = df["Confirmed Qty"] - df["Dispatched Qty"]
df["TSL Qty Loss"] = df["Dispatched Qty"] - df["Delivered Qty"]
df["Total Qty Loss"] = df["Original Order Qty"] - df["Delivered Qty"]# The date comes from inside the file, not its name
for r in range(1, 12):
key_date = next((v.date() for v in row_values(ws, r) if isinstance(v, dt.datetime)), None)
if key_date: break
# Two snapshots of the same plant + material + day: keep the larger, never add them
key = (key_date, norm(plant), norm(material))
lookup[key] = max(lookup.get(key, qty), qty) # qty = "Available Stock"# Total cases dropped per DC + product + delivery date: stock is a shared pool
dropped = dsl_by_group.get((row["Plant"], row["Material"], req), row["DSL Qty Loss"])
found, stock = soh_stock(row["Plant"], row["Material"], req) # that day or the day before
if not found:
return "" # no record: don't guess
return "No SOH" if stock < dropped else "In Stock"edi = df[df["EDI Rejections"] > 0]
is_r2 = edi["Sub-Chain"].str.contains(RETAILER_2_PATTERN, case=False, na=False)
is_r1 = edi["Sub-Chain"].str.contains(RETAILER_1_PATTERN, case=False, na=False, regex=True)
edi_r1 = edi[is_r1 & ~is_r2] # -> account managers: system/price updates at store level
edi_r2 = edi[is_r2] # -> retailer buying team: closed articles on order rosters
edi_other = edi[~is_r1 & ~is_r2] # -> listed for manual routing, never silently droppedWhy it matters
- The stock check is the judgement call. A confirmation drop with stock available is a system or logistics failure; the same drop with no stock is a planning problem. Getting that wrong sends the escalation to the wrong team.
- Judging per warehouse, product and day, rather than per order line, matters because three stores dropped against the same empty shelf are one supply problem, not three logistics ones.
- Files are found by what they contain, so a renamed or re-dated export does not silently drop out of the check.
Result
- One weekly run replaces a manual reconciliation of fourteen stock files against the order extract.
- Every lost case has an owner, and every escalation goes to the team that can fix it.
- The email is generated, not typed: grouped by owner, with deadlines, ready to send.
Production Planning Engine
- Python
- Python
- openpyxl
- pandas
- Excel formula generation
Builds the monthly production plan and the customer pallet orders from four channels’ stock and sales reports, and documents every formula fault it fixed.
The problem
Monthly production was planned in a large, hand-maintained workbook fed by stock reports from four channels. Each report arrived in a different layout, often with an unpredictable filename, and one channel sent only raw invoice lines with no demand figure.
Over time the formulas had drifted. Some rows sat outside their totals, one stock figure was reported in kilograms as if it were cases, inbound stock was inflated by the cover multiplier, one channel would have been counted five times once it went live, and a single missing product could blank a whole customer sheet.
What I built
A script that reads every report dropped into one folder, identifies each one by its contents, and rebuilds the planning workbook from scratch. The workbook has a run summary, a sheet and a Final Production roll-up for each channel, four customer order sheets in full pallets and kilograms, and a Notes tab. Manual figures live in a single Inputs workbook that the script generates and keeps up to date. Every correction to the inherited formulas is listed on the Notes tab, so planners can see exactly what changed and why.
- Drop and run
Planners drop the month’s reports into one folder, fill in Inputs.xlsx (opening stock, inbound and distributor volumes), and run one command. A refresh option rebuilds the inputs grid for new products and keeps everything already typed.
- Identify by content
Each report is recognised from its sheet names and header cells, and two exports in the same ERP format are told apart by a principal field. If there are duplicates, the newest file is used and the rest are listed. Earlier outputs in the folder are skipped.
- Build the rate of sale
For the channel that only sends invoices, sales are summed over the trailing 21 days and divided by the weekdays in that window.
- Match names safely
Product names are normalised for case, spacing and punctuation only, then mapped through a small alias list. Fuzzy matching is deliberately avoided, because it could pair two genuinely different products.
- Write live formulas
Each channel sheet calculates available stock, days of cover and required production, with working days and target cover as editable cells. SUMIFS rolls each one up into a Final Production tab.
- Order in pallets
Customer sheets pull from the Final Production tabs, add distributor volumes and stock cover, deduct opening stock and inbound case for case, and round to full pallets and kilograms.
- Explain
A Summary sheet gives headline figures and status counts. The Notes tab lists every exception from the run and every inherited formula fault, with an action for each.
"formulas": {
6: "=C{r}+D{r}", # available + inbound
7: "=IF(E{r}=0,0,F{r}/E{r})", # days of cover
8: "=MAX(0, E{r} * J${p} + (K${p} - G{r}) * E{r})", # required production
},
"params": {"J": "WorkingDays", "K": "TargetDaysCover"},
# Final Production: one row per product name the report actually used
f"=SUMIFS('{ch}'!H:H, '{ch}'!B:B, A{rr})"def pallet(col, div, thresh=0.3):
# Round up only when the part pallet is worth sending.
return (f"=IF(MOD({col}{{r}}/{div},1)>={thresh},"
f"ROUNDUP({col}{{r}}/{div},0),ROUNDDOWN({col}{{r}}/{div},0))")
# per customer row: requirement, then pallets, then kilograms
11: "=MAX(0, D{r}+J{r}-B{r}-C{r})", # forecast + cover - opening stock - inbound
12: pallet("K", 80), # 80 cases a pallet for this pack
kg: "=L{r}*960", # 80 cases x 12 kglatest = df["Invoice Date"].max()
start = latest - pd.Timedelta(days=20) # trailing 21 days
window = df[(df["Invoice Date"] >= start) & (df["Invoice Date"] <= latest)]
days = int((pd.date_range(start, latest).weekday < 5).sum())
for name, qty in window.groupby("Product Description")["Quantity"].sum().items():
label = LOOKUP.get(norm(name)) # long name -> fixed row label
if label is None:
unknown.add(name); continue # reported on Notes, never guessed
ros[label] = ros.get(label, 0.0) + round(qty / days, 2)def allocate_inbound(inbound, cust_inputs):
# Inbound used to sit on the channel sheet, where it passed through the
# stock-cover multiplier: 100 cases removed 150 from an order. Credit it to
# the customer rows whose own INDEX/MATCH formulas pull that product instead.
for cfg in CUSTOMER_SHEETS:
for label, formulas, _kg in cfg["rows"]:
add = sum(inbound.get(norm(name), 0)
for f in formulas.values()
for name, sheet in re.findall(r'MATCH\("(.+?)",\s*\'(.+?)\'!A:A', str(f))
if SHEET_OF.get(sheet) == "Distributor 1")
if add:
k = (cfg["name"], label, "inbound")
cust_inputs[k] = cust_inputs.get(k, 0) + addWhy it matters
- It writes formulas, not values. The output is still a spreadsheet the planning team owns: change working days or target cover and the whole plan recalculates, down to the pallet order.
- Colour encodes provenance. Blue figures come from a source report, amber are manual inputs, teal are pulled across from another tab, and black are calculated. Anyone can tell at a glance what to trust and what to check.
- Rebuilding the workbook as code surfaced ten formula faults in the original, including inbound stock counted at up to 1.5 times its real value. Each one is fixed, or deliberately kept and flagged, rather than quietly changed.
Result
- A month’s production plan and four customers’ pallet orders, built from four channels’ reports in one run.
- Ten inherited formula faults found and documented, each one either fixed or deliberately kept and flagged.
- The planning team keeps a live, editable workbook, with provenance colour-coded and a sign-off block on the run sheet.
Store Stock Count Report
- Python
- Python
- pandas
- openpyxl
- Conditional formatting
Turns weekly in-store stock counts into one line of priorities: phantom stock, big variances, short-dated stock.
The problem
Merchandisers count stock in store every week and record it next to the retailer portal’s stock figure, along with expiry dates. The master file grew a tab per week, with free-text counts, several expiry dates typed into one cell, and no quick way to see which stores needed action.
The most important distinction was also the easiest to miss: a blank count means nobody looked, while a count of zero against positive system stock means the shelf is empty but the retailer thinks it is full, so it will never reorder.
What I built
A report generator that turns the master file into one clean, formatted tab per week, with stores grouped into region bands. Each tab shows only what matters and flags what needs action: phantom stock, large variances, short-dated or expired stock, and products that were not counted.
- Find the weeks
Every tab in the master file with an expiry column is treated as a week and rebuilt.
- Parse the expiries
Several dates typed into one cell are split out. The earliest is shown with a ‘+’, and the full list sits in a cell comment.
- Separate blanks from zeros
A blank count is ‘Not counted’. A zero count against positive portal stock is ‘Phantom stock’.
- Flag variances
A variance of 3 or more units, or 25% or more of portal stock, is flagged as high.
- Flag expiry
Expired or within 30 days is red, within 60 days is amber.
- Group and summarise
Stores sit under region bands. A one-line tally at the top of each tab counts every flag type, and the sheet prints landscape on one page width with the header row repeated.
phantom = f"AND(ISNUMBER(E{r}),E{r}=0,D{r}>0)"
high = (f"AND(ISNUMBER(F{r}),F{r}<>0,OR(ABS(F{r})>={VAR_UNITS},"
f"AND(D{r}>0,ABS(F{r})/D{r}>={VAR_PCT})))")
v = f'IF(E{r}="","Not counted",IF({phantom},"Phantom stock",IF({high},"High variance","")))'
e = (f'IF(H{r}="","",IF(H{r}<=0,"Expired",IF(H{r}<={RED_DAYS},"Short-dated",'
f'IF(H{r}<={AMBER_DAYS},"Watch expiry",""))))')
flag = f'=IF(AND({v}<>"",{e}<>""),{v}&" + "&{e},{v}&{e})'def expiry_dates(v):
d = to_date(v) # a real date, or one of six text formats
if d:
return [d]
if v is None or (isinstance(v, float) and pd.isna(v)):
return []
return sorted({d for d in (to_date(p) for p in re.split(r"[|;,&]", str(v))) if d})
exps = expiry_dates(row["Expiry Date"])
cell.value = exps[0] if exps else None # earliest batch drives days left
if len(exps) > 1:
cell.comment = Comment("Batches captured:\n" + "\n".join(f"{d:%d %b %Y}" for d in exps), "Report")
cell.number_format = 'dd mmm yyyy" +"'I = f"$I${first}:$I${last}"
ws["A3"] = (f'=COUNTIF({I},"Phantom*")&" phantom stock | "'
f'&COUNTIF({I},"*High variance*")&" high variances | "'
f'&(COUNTIF({I},"*Expired*")+COUNTIF({I},"*Short-dated*"))&" short-dated or expired | "'
f'&COUNTIF({I},"*Watch expiry*")&" to watch | "'
f'&COUNTIF({I},"Not counted*")&" not counted"')
rng = f"G{first}:H{last}" # expiry + days left, first match wins
for test, fill in ((f"$H{first}<=0", DARK), (f"$H{first}<={RED_DAYS}", RED), (f"$H{first}<={AMBER_DAYS}", AMBER)):
ws.conditional_formatting.add(rng, FormulaRule(
formula=[f"AND(ISNUMBER($H{first}),{test})"], fill=fill, stopIfTrue=True))Why it matters
- Flags are written as Excel formulas, not fixed text. Correct a count in the sheet and the variance, flag and tally all update.
- Phantom stock is the flag that matters most commercially. The retailer’s system believes the stock is there, so it never triggers a reorder, and the product quietly disappears from the shelf.
Result
- A week of store counts reduced to one line of priorities per tab.
- Phantom stock, which blocks reordering, is surfaced every week instead of discovered late.
- Short-dated stock is visible 60 days out, while there is still time to move it.
Range Health & Activation Uplift
- Python
- Python
- pandas
- openpyxl
Finds every store where a listed product is not selling, and measures whether in-store activations moved it.
The problem
A product can be listed in hundreds of stores and still not sell in many of them. Store-level sales and stock-on-hand come from separate systems, and neither shows the full picture alone: in a sales report, a store holding stock that never sells looks the same as a store that was never supplied.
The field team also runs in-store activations and needed a fair answer to a simple question: did the activation actually move product?
What I built
Two connected tools. A slow and no-sales workbook classifies every store and product over 6-week and 12-week windows. For each window it gives a full list and a working list of stores holding stock, with article status, replenishment type, stock on hand and last received, sold and ordered dates to act on. An activation report measures each activation day against that store’s own baseline.
- Build the universe
Every store and product combination is taken from both the sales data and the stock data (an outer join), so ranged-but-not-selling stores appear even with zero sales.
- Sum the window
Units sold per store and product over the last 6 and 12 weeks, counted back from the latest day in the sales data.
- Set a fair bar
Each product’s national average is taken across the stores that sell it. Slow means below 50% of that average, with a floor of 3 units.
- Classify
Zero units is ‘No Sales’ and below the bar is ‘Slow Sales’. Each row carries article status, replenishment type, stock on hand and last received, sold and ordered dates.
- Full list, then working list
The script no longer filters on article status. It keeps every row and the status column, and the working tabs are filtered down to stores that hold stock on a live status.
- Measure activations
For each of last week’s activations, the baseline is that store’s average daily units over the 12 weeks before. Pairs with no trade either side are excluded, and a zero baseline with sales on the day is reported as ‘New’.
sales_skus = (sales.groupby(["Store ID", "Short Name"], as_index=False)
.size().drop(columns="size"))
soh_skus = (soh[["Site Code", "Short Name", "Site Article Status", "RP (MRP) Type",
"SOH Qty", "Date Last Received", "Date Last Sold", "Last Ordered Date"]]
.drop_duplicates(subset=["Site Code", "Short Name"])
.rename(columns={"Site Code": "Store ID"}))
# outer join: a ranged store with no sales still gets a row
universe = pd.merge(sales_skus, soh_skus, on=["Store ID", "Short Name"], how="outer")
# stock-file store name preferred, sales name as fallback
universe["Store"] = universe["Store_soh"].where(
universe["Store_soh"].notna() & (universe["Store_soh"].str.strip() != ""),
universe["Store_sales"])
universe["SOH Qty"] = pd.to_numeric(universe["SOH Qty"], errors="coerce").fillna(0)cutoff = ref_date - timedelta(weeks=weeks)
window = sales[(sales["Day"] >= cutoff) & (sales["Day"] <= ref_date)]
agg = window.groupby(["Store ID", "Short Name"], as_index=False)["Units"].sum()
nat_avg = (agg[agg["Units"] > 0] # average across stores that DO sell it
.groupby("Short Name")["Units"].mean())
df = universe.merge(agg, on=["Store ID", "Short Name"], how="left")
df["Units Sold"] = df["Units"].fillna(0)
df["Slow Threshold"] = (df["Short Name"].map(nat_avg) * SLOW_RATIO).clip(lower=SLOW_FLOOR)
df["Status"] = np.select([df["Units Sold"] == 0, df["Units Sold"] < df["Slow Threshold"]],
["No Sales", "Slow Sales"], "OK")for act_date_str, store_id in ACTIVATIONS_LAST_WEEK:
act_date = pd.to_datetime(act_date_str)
base_end = act_date - pd.Timedelta(days=1)
base_start = act_date - pd.Timedelta(weeks=BASELINE_WEEKS) # 12 weeks before
base_days = (base_end - base_start).days + 1
for sku in SKU_MAP.values():
sk = sales[(sales["Store_ID"] == store_id) & (sales["SKU"] == sku)]
act_units = sk.loc[sk["Date"] == act_date, "Units"].sum()
base_units = sk.loc[sk["Date"].between(base_start, base_end), "Units"].sum()
if base_units == 0 and act_units == 0:
continue # non-trading pair
avg_daily = base_units / base_days
uplift = (act_units - avg_daily) / avg_daily if avg_daily > 0 else None # -> "New"Why it matters
- The outer join is the point. A sales-only view cannot see a store that sells nothing, and those are exactly the stores the report exists to find.
- The thresholds are relative. A slow seller is judged against how that product sells elsewhere, so a niche line and a best-seller are each held to their own standard.
- Activations are compared with the same store’s own history, not with other stores, so the uplift figure means what it says.
Result
- 6-week and 12-week views of every store and product that is not selling, with the stock context to act on it.
- Every activation measured against the store’s own baseline, within a week of it happening.
- Account teams get a ready list to take to the retailer, filterable by region and replenishment type.
What I work with, and where to see it.
Each tool links to the case studies that use it.
Qlik Sense2 projects
Qlik load script1 project
Set analysis1 project
Qlik Reporting1 project
Excel7 projects
VBA1 project
Pivot tables1 project
Python7 projects
pandas5 projects
openpyxl5 projects
xlsxwriter1 project
OR-Tools1 project
OSRM1 project
Dynamic programming1 project
BI & Reporting: Qlik Sense, Power BI
Programming: Python, VBA, SQL
Statistical (academic): STATA, R, SAS, EViews
Commercial: Key account management, Margin & pricing, Vendor sheets
Let’s talk about what you need built.
Dual British/South African citizen with full UK right to work. No sponsorship required. Available for remote roles, and happy to engage as an independent contractor invoicing in GBP, or through an EOR.
- Status
- Open to roles
- Working
- Remote
- Engagement
- Contract, EOR or permanent
- Sponsorship
- Not required