Query editor
WITH distinct_days_per_user AS (SELECT "from", COUNT(distinct(DATE(block_time))) as distinct_days, 'linea' as networkFROM linea.transactions WHERE DATE(block_time) >= current_date - interval '90' day and successGROUP BY 1)SELECTtrans_cat,COUNT(DISTINCT("from")) as total_usersFROM (SELECT"from",CASE WHEN distinct_days = 1 then '1 Day'WHEN distinct_days between 1 and 3 then '1-3 Days'WHEN distinct_days between 3 and 5 then '3-5 Days'WHEN distinct_days between 5 and 7 then '5-7 Days'WHEN distinct_days between 7 and 14 then '7-14 Days'WHEN distinct_days between 14 and 20 then '14-20 Days'ELSE '20+ Days'END as trans_cat,CASE WHEN distinct_days = 1 then 1WHEN distinct_days between 1 and 3 then 2WHEN distinct_days between 3 and 5 then 3WHEN distinct_days between 5 and 7 then 4WHEN distinct_days between 7 and 14 then 5WHEN distinct_days between 14 and 20 then 6ELSE 7END as trans_orderFROM distinct_days_per_user) GROUP BY trans_cat,trans_orderORDER BY trans_order