Query editor
with complete_date as (select distinct date_trunc('day', minute) as date_from prices.usdwhere minute >= timestamp '2025-02-11 00:00:00'),new_LPs as(selectdate_trunc('day',date_) as date_,count(account) as new_LPsfrom(select min(evt_block_time) as date_, account from flexperp_base.LiquidityService_evt_AddLiquiditygroup by account)group by 1)SELECTd.date_,new_LPs,AVG(new_LPs) OVER (ORDER BY d.date_ ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS avg_7_days,sum(new_LPs) over (order by d.date_) as Cumulative_LPsFROM complete_date dLEFT JOIN new_LPs u ON d.date_ = u.date_