Skip to content

Instantly share code, notes, and snippets.

@jdwyah
Created June 1, 2017 16:38
Show Gist options
  • Save jdwyah/71bd98a11dfab56b3cdb3c449615e95a to your computer and use it in GitHub Desktop.
Save jdwyah/71bd98a11dfab56b3cdb3c449615e95a to your computer and use it in GitHub Desktop.
cumulative AS (
SELECT
DAY,
experiment_test,
experiment_result,
exposures,
sum(exposures)
OVER (
PARTITION BY experiment_test, experiment_result
ORDER BY DAY
ROWS UNBOUNDED PRECEDING ) cumulative_exposures,
order_placed_1,
sum(order_placed_1)
OVER (
PARTITION BY experiment_test, experiment_result
ORDER BY DAY
ROWS UNBOUNDED PRECEDING ) cumulative_order_placed_1
FROM results
ORDER BY experiment_test, experiment_result, DAY
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment