Capstone — Self-Updating Sales Dashboard

Excel Advanced

Chapter 10 · Capstone: Building a Self-Updating Sales Dashboard

Nine chapters of Excel Advanced each covered one genuinely powerful tool in isolation — dynamic arrays, deeper lookups, PivotTables and PivotCharts, Power Query, the Data Model and DAX, macros, VBA, and formula auditing. This capstone chains all nine into a single realistic project: a Sales Dashboard that imports its own data every month, relates it properly, summarizes it correctly under any filter, and refreshes itself with one click — the kind of workbook the rest of this course was actually building toward.

The Project Brief

Every month, a new CSV export of that month's sales lands in a shared folder. The dashboard needs to: pull in every file in that folder automatically; relate each sale to its product's category; calculate profit margin correctly no matter how the data is sliced; let a user drill down by category, then a live, dependent subcategory list; visualize it with a chart controllable by clickable filters and a date range; and refresh the entire pipeline with a single click, not nine separate manual steps.

Step 1 — Importing and Cleaning Monthly Sales Files

Data → Get Data → From Folder (Chapter 4), pointed at the shared monthly-exports folder, combines every CSV inside it into one query. Applied Steps clean the result: Change Data Type forces Amount and Cost to genuine numbers (not text — avoiding Chapter 4's own PivotTable Count-instead-of-Sum trap), Trim removes stray whitespace from the Category column (avoiding a silent Merge mismatch later), and Remove Duplicates guards against any accidentally re-exported rows.

Step 2 — Relating Sales to a Products Reference Table

Both the cleaned Sales query and a separate Products reference table (ProductID, Category, Subcategory) are loaded into the Data Model (Chapter 5). In Diagram View, Sales[ProductID] is related to Products[ProductID] as a one-to-many relationship — with Products[ProductID] first confirmed unique (Chapter 5's own warning box), avoiding a silently inflated total from a duplicate key.

Step 3 — DAX Measures for Total Sales and Profit Margin

Two measures, defined once in the Data Model (Chapter 5), correctly recalculate under whatever filter the dashboard later applies:

Total Sales := SUM(Sales[Amount]) Profit Margin := DIVIDE(SUM(Sales[Amount]) - SUM(Sales[Cost]), SUM(Sales[Amount]))

Step 4 — A Distinct, Live Category List for Reporting

A small reporting area lists every category currently in use, kept automatically up to date with a dynamic array (Chapter 1):

=SORT(UNIQUE(Products[Category]))

This spilled list needs no maintenance as new categories appear in future monthly imports — it's the same non-destructive, always-current list Chapter 1 built for exactly this reason.

Step 5 — A Dependent Category → Subcategory Dropdown

A Data Validation dropdown (Chapter 2) lets a user pick a Category; a second, dependent dropdown then narrows to just that category's own subcategories, sourced from a live FILTER formula:

Subcategory dropdown's Data Validation Source field: =FILTER(Products[Subcategory], Products[Category]=A2)

Step 6 — Building the PivotTable, PivotChart, Slicer, and Timeline

A PivotTable built from the Data Model (Chapter 3) drags Category into Rows and the Total Sales and Profit Margin measures into Values — no merged table or VLOOKUP needed anywhere, since the relationship (Step 2) already joins Products and Sales live. A PivotChart built directly from it visualizes the same data, and both a Category Slicer and a Date Timeline are connected via Report Connections, so one click on a category button or one drag of the date range filters the PivotTable and PivotChart together, instantly.

Step 7 — Automating the Monthly Refresh with VBA

Rather than manually clicking Refresh All, then re-checking every query, a single macro (Chapters 6-8) does the whole job:

Sub RefreshDashboard() Application.EnableEvents = False ThisWorkbook.RefreshAll Application.EnableEvents = True MsgBox "Dashboard refreshed — " & Format(Now, "dd mmm yyyy hh:nn") End Sub

This macro is assigned to a shape placed directly on the dashboard sheet (Chapter 6) rather than requiring anyone to know where to find it in the Macros list. Application.EnableEvents is wrapped around the refresh specifically because this workbook also has a Worksheet_Change handler elsewhere (Chapter 8) that would otherwise fire redundantly as the refreshed values land in the sheet.

Step 8 — Auditing Before Calling It Done

Before treating the dashboard as finished, Chapter 9's habits apply directly: Trace Precedents on the Profit Margin measure's PivotTable cells confirms it's genuinely pulling from both related tables as intended; Error Checking is run across the whole workbook to catch any stray #REF! left over from earlier iteration; and any IFERROR/IFNA used elsewhere in the workbook is checked against Chapter 9's own rule — reserved for genuinely expected cases (a lookup that legitimately might not match), never used as a blanket way to hide whatever error happens to show up.

Putting It All Together

Dashboard pieceTechnique usedCovered in
Importing every monthly file automaticallyPower Query, From FolderChapter 4
Sales properly linked to ProductsData Model relationship, unique-key checkChapter 5
Correct totals under any filterDAX measures with DIVIDEChapter 5
An always-current category listSORT(UNIQUE(...))Chapter 1
Category → Subcategory dropdownData Validation sourced from FILTERChapter 2
The visual summaryPivotTable, PivotChart, Slicer, TimelineChapter 3
One-click refreshA recorded-then-refined macro, assigned to a shapeChapters 6-7
Avoiding a redundant re-triggerApplication.EnableEvents wrappingChapter 8
Confirming it's actually correctTrace Precedents, Error Checking, disciplined IFERROR/IFNAChapter 9
A genuinely advanced workbook is a stack of ordinary decisions, applied consistently
Nothing in this capstone required a technique beyond what the previous nine chapters already covered individually — the actual skill on display is recognising which of nine familiar tools fits which specific piece of a real, ongoing reporting need, and remembering to apply the earlier chapters' own warnings (unique keys, exact-match joins, disciplined error handling) at every step, not just the one chapter each warning originally appeared in.
A "self-updating" dashboard still depends on the source folder staying consistent
Every piece of automation in this capstone assumes next month's CSV export keeps the same column names and layout as the ones already imported — exactly the fragility Chapter 4's own warning box described for Power Query's recorded steps. A renamed column, a reordered file, or a genuinely new category with no matching Products row would each surface as a specific, diagnosable problem (a broken Applied Step, a blank Category, an unmatched Subcategory) rather than a silent wrong number — provided Step 8's auditing habits are actually followed each month, not skipped once the dashboard starts feeling reliable.

Hands-On Exercises

Exercise 1

Set up the Sales and Products tables from Step 1-2 (a small sample is enough — 2-3 monthly CSVs and a Products table of 5-6 items), relate them in the Data Model, and write the Total Sales and Profit Margin DAX measures from Step 3. Confirm both measures update correctly when a Slicer filters to a single category.

📄 View solution
Exercise 2

Build the dependent Category/Subcategory dropdown pair from Step 5. Add a new subcategory to your Products table for an existing category, and confirm it appears in the dependent dropdown without touching the dropdown's own settings. Explain which chapter's own principle this demonstrates.

📄 View solution
Exercise 3

Your RefreshDashboard macro (Step 7) doesn't wrap ThisWorkbook.RefreshAll in Application.EnableEvents, and the workbook has a Worksheet_Change handler on the Dashboard sheet. Describe specifically what could go wrong when the macro runs, referencing the exact mechanism from an earlier chapter, and show the corrected macro.

📄 View solution

Course Recap — Excel Advanced

  • Ch.1: Dynamic arrays — UNIQUE, SORT, FILTER, spilling, and the # operator
  • Ch.2: Nested/tiered XLOOKUP, Data Validation dropdowns, dependent dropdowns via FILTER
  • Ch.3: Calculated fields, custom grouping, Slicers, Timelines, PivotCharts
  • Ch.4: Power Query — importing, cleaning, Append vs. Merge, recorded Applied Steps
  • Ch.5: The Data Model, table relationships, and an introduction to DAX measures
  • Ch.6: Recording a macro — what it captures, and relative vs. absolute recording
  • Ch.7: VBA fundamentals — variables, the object model, loops, conditionals
  • Ch.8: UserForms and event handlers — code that runs automatically
  • Ch.9: Auditing tools, error values, IFERROR/IFNA, and circular references
  • Ch.10: All of the above, combined into one real, self-updating dashboard