winnie-fsDistribution of Sections' Users By Their Paid Fees (NEAR Labels) copy
Updated 2024-07-26
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
›
⌄
-- forked from Ali3N / Distribution of Sections' Users By Their Paid Fees (NEAR Labels) @ https://flipsidecrypto.xyz/Ali3N/q/XGiT8D1THzy7/distribution-of-sections-users-by-their-paid-fees-near-labels
with maintable as (
select label_type,
tx_signer,
sum (transaction_fee/1e24) as Fees,
avg (transaction_fee/1e24) as Average_Fees,
max (transaction_fee/1e24) as Maximum_Fees,
count (distinct tx_signer) as Users_Count,
count (distinct tx_hash) as TX_Count,
TX_Count / Users_Count as TX_Per_User
from near.core.fact_transactions t1 join near.core.dim_address_labels t2 on t1.tx_receiver = t2.address
where block_timestamp >= '{{From_Date}}' and block_timestamp <= '{{To_Date}}'
group by 1,2)
select label_type,
case when fees < 0.001 then 'Less Than 0.001 $NEAR'
when fees >= 0.001 and fees < 0.01 then '0.001 - 0.01 $NEAR'
when fees >= 0.01 and fees < 0.1 then '0.01 - 0.1 $NEAR'
when fees >= 0.1 and fees < 1 then '0.1 - 1 $NEAR'
else 'More Than 1 $NEAR' end as type,
count (distinct tx_signer) as USers_count
from maintable
group by 1,2
order by 3 desc
QueryRunArchived: QueryRun has been archived