thea[Near] Network Mega
Updated 2023-01-06Copy Reference Fork
999
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 time_frame as (
select case
when '{{quarter}}' = '2022 Q4' then '2022-10-01'
when '{{quarter}}' = '2022 Q3' then '2022-07-01'
when '{{quarter}}' = '2022 Q2' then '2022-04-01'
when '{{quarter}}' = '2022 Q1' then '2022-01-01'
when '{{quarter}}' = '2022 Q4' then '2021-10-01'
when '{{quarter}}' = '2021 Q3' then '2021-07-01'
end as start_date,
case
when '{{quarter}}' = '2022 Q4' then '2023-01-01'
when '{{quarter}}' = '2022 Q3' then '2022-10-01'
when '{{quarter}}' = '2022 Q2' then '2022-07-01'
when '{{quarter}}' = '2022 Q1' then '2022-04-01'
when '{{quarter}}' = '2021 Q4' then '2022-01-01'
when '{{quarter}}' = '2021 Q3' then '2021-10-01'
end as end_date
),
active_address as
(
select 'Active Addresses' as metric,
count(distinct tx_signer) as value
from near.core.fact_transactions
where tx_status = 'Success'
and block_timestamp >= (select start_date from time_frame)
and block_timestamp >= (select end_date from time_frame)
),
new_address as (
select 'New Addresses' as metric,
count(tx_signer) as value
from (
select block_timestamp,
tx_signer,
row_number() over (partition by tx_signer order by block_timestamp) as rnk
from near.core.fact_transactions
)
Run a query to Download Data