Business Analysis / Learning brief

Sam builds a status report by list

What this means in plain language

Sam builds a pivot-style report with conditional totals and checks that the columns add up.

Understand the full idea, step by step

Analogy: sorting coins. A bank clerk can count a pile of coins in one go. A better clerk makes separate stacks while counting, one for each kind, and reports all the stacks together.

The analogy is one query with several conditions; the engine decides how many physical scans it needs.

A conditional total is a separate stack. Sam, a business analyst at Daily List, a to-do list app, asks for one line per list with a stack for each status.

Evidence & review

REVIEWED 2026-10-31

The date on this lesson is when it went up on Payments Signal, not when its material was written — most of these were brought across from an earlier catalogue in a single run, which is why so many of them share a date. What the lesson says about the world is dated by the review above and by the sources below it.

Using conditional totals in a query. The people and app are invented.

What this brief simplifies: Fiction labelled SYNTHETIC / TRAINING ONLY. Sources were seen only as search excerpts. Tools and screens change, and each team sets its own.

Sources for this brief — 3 sources
  1. Market practice

    Aggregate functions (PostgreSQL tutorial) ↗ — PostgreSQL · PostgreSQL tutorial: an aggregate can carry a filter clause, so rows that fail the filter never reach that aggregate while other aggregates in the same query still see them (search excerpt, page not opened)

    The PostgreSQL tutorial page on aggregate functions, grouping and the filter clause on an aggregate. Official project documentation. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Value expressions and aggregate filters (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL reference: the filter clause keeps rows out of one aggregate, and a CASE check cannot protect an average from a bad row because aggregates run over all input rows (search excerpt, page not opened)

    §4.2.7–8 aggregate/window expressions; §4.2.14 evaluation limits. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §4.2.7–8 aggregate/window expressions; §4.2.14 evaluation limits. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  3. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

Learn this properly

START HEREConditional totals and pivot-style reports in a queryGroup many rows into one line each, with a column per status. Learn conditional totals with CASE (a rule-based choice) and a row filter, and when a pivot report fits.Opens at L0 Explain simply · about 15 min

Related briefs