Hello
I know I can create a computation where I get users who performed action in the last N days and then filter the number of actions.
However, I want to get the number of users who performed the action N times in the rolling N days.
Is it possible to achieve? I attached the SQL that is achieving what I want to achieve in Amplitude.
SELECT date, COUNT(DISTINCT user_id) FROM (<br /> SELECT<br /> user_id,<br /> date,<br /> SUM(score) OVER (<br /> PARTITION BY user_id<br /> ORDER BY date<br /> ROWS BETWEEN 6 PRECEDING AND CURRENT ROW<br /> ) AS rolling_7_day_sum<br /> FROM table_name<br />)<br />WHERE rolling_7_day_sum > 25
The sql assumes that there is a row for every day for each user