By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| Year | Month | customers | Invoices | Products | Total_Income | Total_Income_A |
|---|---|---|---|---|---|---|
| 2015 | 1 | 2 | 2 | 2 | 700 | 300 |
| 2015 | 2 | 1 | 1 | 1 | 450 | 0 |
| 2016 | 1 | 1 | 1 | 1 | 300 | 300 |
| 2016 | 2 | 1 | 1 | 1 | 300 | 0 |
Warning: Null value is eliminated by an aggregate or other SET operation.