Query editor
/* ===================================================STAGE 2f: ATTRITION TABLE (appendix), per countryEach column is the count left after that step. after_transfers_main_sampleis the main sample; the persistent subsample is a robustness check.transacted_only_users: sent stablecoins (above $0) but never held at thethreshold (alternative user definition, not in the main sample).=================================================== */WITH screens AS (SELECT country,COUNT(*) AS linked,COUNT_IF(NOT flag_institutional) AS after_institutional,COUNT_IF(passes_screens) AS after_activity_size_contractFROM dune.boc.result_wallet_screensGROUP BY country),sample AS (SELECT country,COUNT_IF(stablecoin_user) AS stablecoin_users,COUNT_IF(stablecoin_user AND NOT flag_velocity) AS after_velocity,COUNT_IF(in_sample) AS after_transfers_main_sample,COUNT_IF(in_sample_persistent) AS persistent_subsample_gdp,COUNT_IF(in_sample AND passes_persistence_flat_10) AS persistent_subsample_flat_10,COUNT_IF(transacted_only) AS transacted_only_usersFROM dune.boc.result_sample_walletsGROUP BY country)SELECT s.*, x.stablecoin_users, x.after_velocity, x.after_transfers_main_sample,x.persistent_subsample_gdp, x.persistent_subsample_flat_10,x.transacted_only_usersFROM screens sLEFT JOIN sample x ON x.country = s.countryORDER BY s.linked DESC