Query editor
with non_vote as (selectdate_trunc('day', block_time) as day,sum(fee/1e9) as fee,sum(fee/1e9*0.5) as burnfrom solana.transactionsgroup by 1),vote as (selectdate_trunc('day', block_time) as day,sum(fee/1e9) as fee,sum(fee/1e9*0.5) as burnfrom solana.vote_transactionsgroup by 1),price as (select date_trunc('day', minute) as day,avg(price) as pricefrom prices.usdwhere contract_address is nulland symbol = 'SOL'and blockchain is nullgroup by 1),total as (select day, sum(fee) as fee, sum(burn) as burn from (select * from voteunion allselect * from non_vote)agroup by 1),final as (select *, sum(burn) over (order by time) as cumulative_burnfrom (selectdate_trunc((casewhen '{{Total Fees Timeframe}}' = '1 Year' then 'day'when '{{Total Fees Timeframe}}' = '2 Years' then 'week'when '{{Total Fees Timeframe}}' = 'All-time' then 'month'end), a.day) as time,sum(fee) as fee,sum(fee*price) as fee_usd,sum(burn) as burn,sum(burn*price) as burn_usdfrom total aleft join price bon a.day=b.daygroup by 1)a)select * from finalwhere time>=(casewhen '{{Total Fees Timeframe}}' = '1 Year' then date(now() - interval '1' year)when '{{Total Fees Timeframe}}' = '2 Years' then date(now() - interval '2' year)when '{{Total Fees Timeframe}}' = 'All-Time' then date('2023-06-02')end)