Count and sum different conditions in one group

Build conditional counts, totals and safe shares without confusing filtered input, missing values and zero. Windows, views and conditional aggregates · Databases.

A report can show zero paid orders, missing revenue, or a zero-percent share for different reasons. Conditional aggregates keep those reasons visible.

What you will learn

  • Separate WHERE, per-aggregate FILTER and HAVING populations
  • Use CASE with COUNT and SUM while preserving NULL meaning
  • Guard conditional ratios with numeric types and NULLIF

Lesson outline

  1. One group, several populations
  2. CASE and FILTER for counts and totals
  3. Empty input and safe shares

20 minutes · 2 scenes · 0 predict checks · 10 quiz questions

The full lesson is available with Premium.