rajsTerra New Users by Day
Updated 2023-01-23
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
›
⌄
with users as
(
SELECT
tx_sender,
min(block_timestamp) as date_joined
from terra.core.fact_transactions
group by 1
)
SELECT
date_trunc('{{Granularity}}', date_joined) as date,
case when ('{{Granularity}}' = 'day' and date_trunc('{{Granularity}}', date_joined) = '2023-01-14') or
('{{Granularity}}' = 'hour' and date_trunc('{{Granularity}}', date_joined) = '2023-01-14 18:00:00.000')
then '2. Announcement Date'
when ('{{Granularity}}' = 'day' and date_trunc('{{Granularity}}', date_joined) < '2023-01-14') or
('{{Granularity}}' = 'hour' and date_trunc('{{Granularity}}', date_joined) < '2023-01-14 18:00:00.000')
then '1. Before Announcement Date'
when ('{{Granularity}}' = 'day' and date_trunc('{{Granularity}}', date_joined) > '2023-01-14') or
('{{Granularity}}' = 'hour' and date_trunc('{{Granularity}}', date_joined) > '2023-01-14 18:00:00.000')
then '3. After Announcement Date'
end as period,
count(tx_sender) as no_of_new_users
from users
where date_joined between '{{StartDate}}' and '{{EndDate}}'
group by 1,2
order by 1
Run a query to Download Data