rajsCosmos # of Voters Over Time
Updated 2023-01-12Copy 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 voters as
(
SELECT
voter,
min(block_timestamp) as min_date
from cosmos.core.fact_governance_votes
where tx_succeeded
group by 1
)
,
new_voters as
(
SELECT
date_trunc('week', min_date) as date,
count(voter) as no_of_new_voters
from voters
group by 1
)
,
active_voters as
(
SELECT
date_trunc('week', block_timestamp) as date,
count(distinct voter) as no_of_active_voters
from cosmos.core.fact_governance_votes
where tx_succeeded
group by 1
)
SELECT
a.*,
no_of_new_voters,
no_of_active_voters - no_of_new_voters as no_of_returning_voters,
sum(no_of_new_voters) over (order by n.date) as cum_no_of_voters
Run a query to Download Data