Query editor
WITH swap_fees AS (SELECTevt_tx_hash,evt_index,evt_block_date AS Date,fee / 1e6 AS fee_tier,chainFROM uniswap_v4_multichain.poolmanager_evt_swap), base AS (SELECTf.*,t.amount_usd AS swap_amount_usd,TRY_CAST(t.amount_usd AS DOUBLE) * TRY_CAST(f.fee_tier AS DOUBLE) AS swap_fee_usdFROM swap_fees AS fINNER JOIN dex.trades AS tON t.block_date = f.DateAND t.blockchain = f.chainAND t.tx_hash = f.evt_tx_hashAND t.evt_index = f.evt_index)SELECTDate,SUM(swap_amount_usd) AS total_swap_amount_usd,SUM(SUM(swap_amount_usd)) OVER (ORDER BY Date) AS Cumulative_Swap_Amount,SUM(swap_fee_usd) AS total_swap_fee_usd,SUM(SUM(swap_fee_usd)) OVER (ORDER BY Date) AS Cumulative_FeesFROM baseGROUP BYDateORDER BYDate DESC