jackguyNFL ALL day 4
Updated 2022-12-05Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with tab1 as (
SELECT
buyer,
min(date_trunc('day',block_timestamp)) as min_day
-- date_trunc('day',block_timestamp) as day,
-- MOMENT_TIER,
-- CASE WHEN block_timestamp BETWEEN '2022-11-19' AND '2022-11-26' THEN 'Thanksgiving Week' ELSE 'Other Days' end as time_period,
-- avg(price) as price,
-- sum(price) as volume,
-- count(DISTINCT ) as buyers,
-- count(DISTINCT SELLER) as sellers,
-- COUNT(DISTINCT tx_id) as sales
FROM flow.core.ez_nft_sales
LEFT outer JOIN flow.core.dim_allday_metadata
ON flow.core.dim_allday_metadata.nft_id = flow.core.ez_nft_sales.nft_id
WHERE flow.core.ez_nft_sales.nft_collection LIKE '%AllDay'
AND block_timestamp > CURRENT_DATE - 365
GROUP BY 1
)
SELECT
*,
sum(new_users) over (ORDER BY min_day) as cume_users
FROM (
SELECT
min_day,
CASE WHEN min_day BETWEEN '2022-11-19' AND '2022-11-26' THEN 'Thanksgiving Week' ELSE 'Other Days' end as time_period,
count(*) as new_users
FROM tab1
GROUP BY 1,2
)
ORDER by 1 desc
Run a query to Download Data