Created
February 14, 2022 14:00
-
-
Save achad4/6c9b8d97d78b6408d65c90c70f01aaf8 to your computer and use it in GitHub Desktop.
Example of metrics query for article
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
| WITH month_0 AS | |
| ( | |
| SELECT user_id, | |
| metric_a | |
| FROM analytics_table | |
| WHERE execution_date = < month_0 > | |
| ), | |
| month_1 AS | |
| ( | |
| SELECT user_id, | |
| metric_a | |
| FROM analytics_table | |
| WHERE execution_date = < month_1 > | |
| ) | |
| SELECT user_id, | |
| ABS(m1.metric_a - m0.metric_a) AS abs_shift | |
| FROM month_0 AS m0 | |
| INNER JOIN month_1 AS m1 USING (user_id) | |
| WHERE abs_shift > < X > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment