Query editor
with complete_data as (select *from query_3807464),total_btc_amount_per_day as (selecttime,sum(btc_amount) as total_btc_amountfrom complete_datagroup by timeorder by time),btc_amount_changes as (selecttime,total_btc_amount,lag(total_btc_amount, 1) over (order by time) as prev_total_btc_amount_1d,lag(total_btc_amount, 7) over (order by time) as prev_total_btc_amount_7dfrom total_btc_amount_per_day),btc_amount_summary as (selecttime,total_btc_amount,-- prev_total_btc_amount_1d,-- prev_total_btc_amount_7d,(total_btc_amount - coalesce(prev_total_btc_amount_1d, 0)) as btc_amount_change_1d,(total_btc_amount - coalesce(prev_total_btc_amount_7d, 0)) as btc_amount_change_7d,((total_btc_amount - coalesce(prev_total_btc_amount_1d, 0)) / nullif(prev_total_btc_amount_1d, 0))*100 as btc_amount_change_pct_1d,((total_btc_amount - coalesce(prev_total_btc_amount_7d, 0)) / nullif(prev_total_btc_amount_7d, 0))*100 as btc_amount_change_pct_7dfrom btc_amount_changes)select * from btc_amount_summaryorder by time desc;