select date_trunc ('{{Time_Interval}}',mindate) as date,
count (distinct buyer) as New_Buyers,
sum (New_Buyers) over (order by date) as Cumulative_Buyers
from (
select buyer,
min (block_timestamp) as mindate
from flow.nft.ez_nft_sales
where tx_succeeded ilike 'TRUE'
and substr(nft_collection,20) ilike '%{{NFT_Collection}}%'
group by 1)
where mindate >= '{{Start_Date}}' and mindate <= '{{End_Date}}'
group by 1
order by 1 desc