This file contains 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 | |
cohort, | |
count(user_id) as cnt_users, | |
sum(cnt_sundae_orders) as total_sundae_orders, | |
sum(cnt_orders) as total_orders, | |
sum(total_order_value) as total_order_value, | |
sum(is_user_converted::int) as cnt_converted_users, | |
total_sundae_orders / cnt_users as avg_sundae_orders, | |
total_orders / cnt_users as avg_orders, | |
total_order_value / total_orders as avg_order_value, |
This file contains 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
create table experiments.sundae_wizard_users as | |
-- Get all users exposed to the experiment | |
with exposed_users as ( | |
select | |
experiment_name, | |
user_id, | |
feature_flag_evaluation, | |
evaluated_at |
This file contains 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
/* | |
Suppose tb1 contains 31 rows: | |
day (Jan 1 to Jan 31) | |
mins (mins generated that day) | |
And I want to know the percent distribution of mins for each day in January (i.e., (mins / total_Jan_mins) ). | |
*/ | |
-- Query 1 (CTE) |
This file contains 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
library(prophet) | |
df # A data frame with columns ds & y (datetimes & metrics) | |
# Create a prophet object | |
m <- prophet(df) | |
# Extend dataframe 100 days into the future | |
future <- make_future_dataframe(m, periods = 100) |