Query editor
with raw_data as (select time, issuer, cumulative_balancefrom query_3960347),etf_entity as (select distinct etf_ticker, issuerfrom query_3944107),fee_data as (select issuer, percentage_feefrom query_3944634),prep as (select a.time, a.issuer, b.etf_ticker, f.percentage_fee as fee, a.cumulative_balancefrom raw_data aleft join etf_entity b on a.issuer = b.issuerleft join fee_data f on a.issuer = f.issuer),change as (select rank() over (partition by time order by cumulative_balance desc) as "rank", time, issuer, etf_ticker,fee, cumulative_balance, cumulative_balance/lag(cumulative_balance,1) over (partition by issuer order by time) as daily_change,cumulative_balance/lag(cumulative_balance,7) over (partition by issuer order by time) as weekly_changefrom prep)select "rank", issuer, etf_ticker, fee, cumulative_balance, daily_change, weekly_changefrom changewhere time = (select max(time) from prep)order by cumulative_balance desc