Query editor
WITH static AS (SELECT split('{{symbol}}', ',') AS selected_symbols),symbols AS (SELECT symbolFROM staticCROSS JOIN UNNEST(selected_symbols) AS t(symbol)),static_1 AS (SELECT split('{{blockchain}}', ',') AS selected_blockchains),blockchains AS (SELECT blockchainFROM static_1CROSS JOIN UNNEST(selected_blockchains) AS t(blockchain)),t1 as (SELECTdate_at,UPPER(blockchain) as blockchain,symbol,source_type,volume_amount_usdFROM dune.near.dataset_near_intents_metrics)selectdate_at,sum(cast(volume_amount_usd as double)) as volume_usd,sum(case when source_type='public' then cast(volume_amount_usd as double) end) as public_volume_usd,sum(case when source_type='confidential' then cast(volume_amount_usd as double) end) as confidential_volume_usd,sum(sum(cast(volume_amount_usd as double))) over (order by date_at rows between unbounded preceding and current row) as cumulative_volume_usd,sum(sum(case when source_type='public' then cast(volume_amount_usd as double) end)) over (order by date_at rows between unbounded preceding and current row) as cumulative_public_volume_usd,sum(sum(case when source_type='confidential' then cast(volume_amount_usd as double) end)) over (order by date_at rows between unbounded preceding and current row) as cumulative_confidential_volume_usdfrom t1WHERE IF('ALL' IN (SELECT symbol FROM symbols),TRUE,symbol IN (SELECT symbol FROM symbols))AND IF('ALL' IN (SELECT blockchain FROM blockchains),TRUE,UPPER(blockchain) IN (SELECT blockchain FROM blockchains))group by date_atorder by date_at desc