Query editor
WITHtrades AS (SELECT*FROM/* Friend Tech */query_2944141),firstUserOccurrences AS (SELECTtrader,MIN(trades.block_date) AS firstTradeDateFROMtradesGROUP BYtrader),statsByDay AS (SELECTblock_date,SUM(volumeUSD) AS volumeUSD,SUM(volumeETH) AS volumeETH,COUNT(DISTINCT (trades.trader)) AS numberOfTraders,COALESCE(COUNT(DISTINCT (firstUserOccurrences.trader)), 0) AS numberOfNewTraders,COUNT(DISTINCT (trades.trader)) - COALESCE(COUNT(DISTINCT (firstUserOccurrences.trader)), 0) AS numberOfReturningTraders,SUM(feeUSD) AS feesUSD,SUM(feeETH) AS feesETH,SUM(IF(type = 'Buy', volumeUSD, NULL)) AS buyVolumeUSD,SUM(IF(type = 'Buy', volumeETH, NULL)) AS buyVolumeETH,SUM(IF(type = 'Sell', volumeUSD, NULL)) AS sellvolumeUSD,SUM(IF(type = 'Sell', volumeETH, NULL)) AS sellVolumeETH,COUNT(DISTINCT (tx_hash)) AS numberOfTrades,SUM(shareAmount) AS numberOfSharesTraded,COUNT(DISTINCT (subject)) AS numberOfSubjects,SUM(COALESCE(COUNT(DISTINCT (firstUserOccurrences.trader)), 0)) OVER (ORDER BYblock_date) AS cumulative_numberOfNewTradersFROMtradesLEFT OUTER JOIN firstUserOccurrences ON (trades.trader = firstUserOccurrences.traderAND trades.block_date = firstUserOccurrences.firstTradeDate)GROUP BYblock_date)SELECT*,SUM(volumeUSD) OVER (ORDER BYblock_date) AS cumulative_volumeUSD,SUM(volumeETH) OVER (ORDER BYblock_date) AS cumulative_volumeETH,SUM(feesUSD) OVER (