Query editor
with first_flex_loan as (selectmin(evt_block_time) as first_flex_loanfrom query_3015748 where isprorata = true)selectdate_trunc('month', evt_block_time) as period,CASE WHEN isprorata = TRUE THEN 'flexible' else 'fixed' end as loan_type,count(distinct loan_id) as loans,sum(loan_amount_usd) as loans_volumefrom query_3015748 where evt_block_time >= (select date_trunc('day', first_flex_loan) from first_flex_loan)--cast ('2024-09-01' as date)group by 1,2