Query editor
WITHTraded_Collections AS (SELECTCASEWHEN coalesce(ctokens.is_creator_token, false) THEN 'CREATOR'ELSE 'VANILLA'END AS collection_type,nft_contract_address,trades.blockchain as blockchain,SUM(amount_usd) as volumeUSD,date_trunc('week', block_time) as block_weekFROMnft.trades trades left joinlimitbreak.creator_tokens ctokens on trades.nft_contract_address = ctokens.address and trades.blockchain = ctokens.blockchainWHERE DATE(date_trunc('day', block_time)) > DATE('2023-05-01')GROUP BY trades.blockchain, nft_contract_address, ctokens.is_creator_token, date_trunc('week', block_time))SELECTblock_week,collection_type,SUM(volumeUSD) as volumeUSDFROM Traded_CollectionsWHERE blockchain={{Chain}}GROUP BY collection_type, block_weekORDER BY collection_type, block_week