Referee

Pick two departments. The referee walks from one number to the other, step by step, and every step links to its rows. Everything is computed in SQL; nothing is estimated.

Marketing counts 1'102 leads created in September 2026. Finance counts 192 leads invoiced. Both are right; they count different things. Step by step:

  • −843 leads are not invoiced (yet)
  • −200 leads are invoiced in a later month
  • +133 invoices are for leads created in an earlier month

= 192 leads invoiced (Finance).

Step What Leads Rows
Start Marketing: leads created 1'102
minus Leads not invoiced (yet) 843

Show rows

minus Leads invoiced in a later month 200

Show rows

plus Invoices for leads created in an earlier month 133

Show rows

End Finance: leads invoiced 192