Module 04 Summary
The idea this module was built around
Summarising is lossy by design. The skill is knowing exactly what you threw away, and being able to prove that what remains still adds up to what you started with.
What you can now do
- Group at a chosen grain and state which detail the grouping discarded
- Use
HAVINGfor conditions on aggregates andWHEREfor conditions on rows, knowing why they differ - Check that segment totals reconcile to the overall total, every time
The trap this module removed
Filtering out a segment you find inconvenient breaks reconciliation. Excluding customers with no recorded country leaves 927 orders and ₹25,21,068 - against a true completed total of 988 orders and ₹26,85,905. Anyone who adds up your rows will find the ₹1,64,837 gap, and they will find it in the meeting.
Keep the bucket. COALESCE(country, 'Not recorded') turns a hidden exclusion into a visible, honest row.
Figures worth remembering
Completed revenue by country: IN ₹18,20,744 (671 orders) - GB ₹5,11,887 (187) - SG ₹1,88,437 (69) - not recorded ₹1,64,837 (61). Total 988 orders, ₹26,85,905 - the parts sum to the whole.
Before you move on
Take any breakdown you have produced recently and add the total row. If the parts do not sum to the whole, you have either a filter you forgot about or a finding you have not reported yet.
