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.

Operations counts 459 appointments in September 2026. Finance counts 192 leads invoiced. Both are right; they count different things. Step by step:

  • −214 appointments are not invoiced (yet)
  • −145 appointments are invoiced in a later month
  • +92 invoices are for appointments held in an earlier month

= 192 leads invoiced (Finance).

Step What Leads Rows
Start Operations: appointments 459
minus Appointments not invoiced (yet) 214

Show rows

minus Appointments invoiced in a later month 145

Show rows

plus Invoices for appointments held in an earlier month 92

Show rows

End Finance: leads invoiced 192