Query editor
withstatic as (selecttimestamp '2022-12-25' as ts_from, '{{timebox}}' as timebox, 60 * 24 * 60 * 60 as depth_back_seconds -- (days) * (hours per day) * (minutes per hour) * (seconds per minute) -- period in seconds according to which the forecast is based, to_unixtime(date_trunc('month', now()) + interval '1' month) - to_unixtime(now()) as seconds_left_in_timebox, date_trunc('month', now()) - interval '24' month as displayed_period), fusion as (selectdate_trunc((select timebox from static), block_time) as time, split_part(upper(blockchain), '_', 1) as blockchain, count(distinct order_hash) as orders, count(distinct user) as users, count(distinct user) filter(where account_rn = 1) as users_new, sum(amount_usd) as volumefrom (select *, row_number() over(partition by user order by block_time) as account_rnfrom oneinch.swapswhere trueand tx_success and call_successand mode = 'fusion')group by 1, 2)-- output --select*, cast(users - users_new as double) / (users) as users_ratiofrom fusionwhere time >= (select displayed_period from static)order by time desc, volume desc