Created
October 6, 2015 00:02
-
-
Save fadur/e3f80f4283699c410747 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select date_trunc('month', start_date), sum(count(user_id)) | |
| over ( | |
| PARTITION by date_trunc('month', start_date) | |
| ROWS BETWEEN 24 PRECEDING AND 1 PRECEDING | |
| ) | |
| from cart_orders | |
| where status in (1,2) | |
| group by 1 | |
| order by 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was thinking something like the following.
You can check the results by copying into a spreadsheet and selecting 24 month windows for the new_users_this_month field.