By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| accountid | purchase_date | new_distinct_rows | running_distinc_count |
|---|---|---|---|
| a1 | 2022-01-01 | 1 | 1 |
| a1 | 2022-01-02 | 0 | 1 |
| a1 | 2022-01-03 | 0 | 1 |
| a1 | 2022-01-04 | 0 | 1 |
| a1 | 2022-01-05 | 1 | 2 |
| a1 | 2022-01-06 | 0 | 2 |
| a1 | 2022-01-07 | 0 | 2 |
| a1 | 2022-01-08 | 1 | 3 |
| a1 | 2022-01-09 | 0 | 3 |
| a1 | 2022-01-10 | 0 | 3 |
| a1 | 2022-01-11 | 1 | 4 |
| accountid | purchase_date | new_distinct_rows | running_distinc_count |
|---|---|---|---|
| a1 | 2022-01-01 | 1 | 1 |
| a1 | 2022-01-05 | 1 | 2 |
| a1 | 2022-01-08 | 1 | 3 |
| a1 | 2022-01-11 | 1 | 4 |