with mintable as (
select tx_sender as New_User,
min (block_timestamp) as mindate
from terra.core.fact_transactions
where tx_succeeded = 'TRUE'
group by 1)
select date_trunc (day,block_timestamp) as date,
case when block_timestamp::date >= '2022-12-24' then 'Holidays and New Year'
else 'Other' end as timespan,
count (distinct tx_id) as TX_Count,
count (distinct tx_sender) as Active_Users_Count,
count (distinct new_user) as New_Users,
sum (fee) as Total_Fee,
avg (fee) as Average_Fee
from terra.core.fact_transactions t1 join mintable t2 on t1.block_timestamp::Date = t2.mindate::date
where tx_succeeded = 'TRUE'
and block_timestamp >= '2022-12-01'
group by 1,2
order by 1