Query editor
withbase as (SELECTdistinct month, userFROM (SELECTdate_trunc('month', block_time) as month, buyer as userFROM nft.tradesWHERE blockchain = '{{chain}}'AND project = '{{project}}'UNION ALLSELECTdate_trunc('month', block_time) as month, seller as userFROM nft.tradesWHERE blockchain = '{{chain}}'AND project = '{{project}}')), user_cohort as (--get the cohort start month for a specific user addressSELECTmin(month) as cohort, userFROM basegroup by 2), cohort_size as (SELECTcohort, count(*) as total_sizeFROM user_cohortgroup by 1), active_by_cohort as (SELECTcohort, month, row_number() OVER (partition by cohort order by month asc) as months, active_addressesFROM (SELECTu.cohort, b.month, count(*) as active_addressesFROM base bLEFT JOIN user_cohort u ON u.user = b.usergroup by 1,2)), retention_base as (SELECTa.cohort