Query editor
WITH peers AS (SELECT * FROM (VALUES(0x9dc39b51782d13e3d6a350553107089eacc0b336, 'The Beaks'),(0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 'Fidenza'),(0x33fd426905f149f8376e227d0c9d3340aad17af1, 'Ringers'),(0x059edd72cd353df5106d2b9cc5ab83a52287ac3a, 'Chromie Squiggle'),(0x036721e5a769cc48b3189efbb9cce4471e8a48b1, 'Checks'),(0x6339e5e072086621540d0362c4e3cea0d643e114, 'Opepen'),(0x313e99d23d6a9ed47af8dccd545c2685f21ec44b, 'Del Mundos')) AS t(addr, name)),daily_floor AS (SELECTDATE(t.block_time) AS day,p.name AS collection,MIN(t.amount_original) AS floor_ethFROM nft.trades tJOIN peers p ON p.addr = t.nft_contract_addressWHERE t.block_time >= CURRENT_TIMESTAMP - INTERVAL '30' DAYAND t.amount_original IS NOT NULLGROUP BY 1, 2),baseline AS (SELECT collection, MIN_BY(floor_eth, day) AS base_floorFROM daily_floorGROUP BY collection),indexed AS (SELECTdf.day, df.collection,ROUND(df.floor_eth * 100.0 / b.base_floor, 2) AS floor_indexFROM daily_floor dfJOIN baseline b ON b.collection = df.collection)SELECTday,APPROX_PERCENTILE(floor_index, 0.5) AS art_floor_index_medianFROM indexedWHERE collection != 'The Beaks'GROUP BY dayORDER BY day;