Query editor
WITH deduped AS (SELECT address, productFROM (SELECT *,ROW_NUMBER() OVER (PARTITION BY LOWER(address) ORDER BY ingestion_ts DESC) AS rnFROM dune.credora_risk.ratings) rankedWHERE rn = 1)SELECTCASE productWHEN 'savings' THEN 'vaults'ELSE productEND AS label,COUNT(*) AS countFROM dedupedGROUP BYCASE productWHEN 'savings' THEN 'vaults'ELSE productENDORDER BY count DESC