Query editor
WITH current_recipient AS (SELECT MAX_BY(recipient, evt_block_time) AS recipientFROM moodymadness_abstract.moodymadnessassets_evt_primarysalerecipientupdatedWHERE contract_address = 0x35ffe9d966e35bd1b0e79f0d91e438701ea1c644),recipient_totals AS (SELECTcurrency_symbol,primary_sale_recipient,MIN(sale_time) AS first_paid_sale_utc,MAX(sale_time) AS last_paid_sale_utc,COUNT(DISTINCT tx_hash) AS paid_orders,COUNT(DISTINCT buyer) AS unique_buyers,CAST(SUM(CAST(quantity AS DOUBLE)) AS BIGINT) AS paid_units,SUM(gross_revenue_crypto) AS gross_revenue_crypto,SUM(gross_revenue_usd) AS gross_revenue_usd,COUNT_IF(settlement_status = 'SETTLED_AND_FORWARDED') AS settled_rows,COUNT_IF(settlement_status = 'AWAITING_TRANSFER_INDEX') AS awaiting_index_rows,COUNT_IF(settlement_status = 'UNMATCHED_REVIEW') AS unmatched_rowsFROM query_7995475WHERE gross_revenue_crypto > 0GROUP BY 1, 2)SELECTr.currency_symbol,r.primary_sale_recipient,CASE WHEN r.primary_sale_recipient = c.recipient THEN 'CURRENT' ELSE 'HISTORICAL' END AS recipient_status,r.first_paid_sale_utc,r.last_paid_sale_utc,r.paid_orders,r.unique_buyers,r.paid_units,ROUND(r.gross_revenue_crypto, 6) AS gross_revenue_crypto,ROUND(r.gross_revenue_usd, 2) AS gross_revenue_usd,ROUND(100.0 * r.gross_revenue_usd / SUM(r.gross_revenue_usd) OVER (), 2) AS lifetime_revenue_share_pct,r.settled_rows,r.awaiting_index_rows,r.unmatched_rowsFROM recipient_totals rCROSS JOIN current_recipient cORDER BY r.gross_revenue_usd DESC