Query editor
with megaphone0 as (selectevt_tx_hash,evt_index,evt_block_time,evt_block_number,amount,amount/1000000 as aum,currency,duration,megaphoneId,profileId,referencedContentId,referencedProfileId,startTime,"timestamp",date(from_unixtime("timestamp", 8, 0)) as block_ddfrom test123_base.OspRouterImmutable_evt_MegaphoneCreated)select block_dd,megaphone_user,megaphone_cnt,megaphone_revenue,sum(new_megaphone_user)over(order by block_dd asc) as sum_megaphone_user,sum(megaphone_cnt)over(order by block_dd asc) as sum_megaphone_cnt,sum(megaphone_revenue)over(order by block_dd asc) as sum_megaphone_revenuefrom(select a.block_dd,count(distinct a.profileId) as megaphone_user,sum(a.megaphone_cnt) as megaphone_cnt,sum(a.megaphone_revenue) as megaphone_revenue,count(case when b.min_dd=a.block_dd then a.profileId end) as new_megaphone_userfrom(select block_dd,profileId,count(1) as megaphone_cnt,sum(aum) as megaphone_revenuefrom megaphone0group by block_dd,profileId) as aleft join(select profileId,min(block_dd) as min_ddfrom megaphone0group by profileId) as bon a.profileId=b.profileIdgroup by a.block_dd);