binhachonDAI on the Market - Where are DAI?
    Updated 2022-01-16
    with DAI_in_pools as (
    select
    balance_date,
    case
    when user_address in ('0xe78388b4ce79068e89bf8aa7f218ef6b9ab0e9d0', '0x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf', '0xc564ee9f21ed8a2d8e7e76c085740d5e4c5fafbe') then 'Bridges'

    else coalesce(label_type, 'Others') end
    as corrected_label_type,
    sum(balance) as total_balance
    -- label_subtype,
    -- label_type,
    from ethereum.erc20_balances
    where contract_address = '0x6b175474e89094c44da98b954eedeac495271d0f'
    group by balance_date, corrected_label_type
    )
    select
    *,
    100 * ratio_to_report(total_balance) over (partition by balance_date) as percentile
    from DAI_in_pools
    order by balance_date, percentile




    Run a query to Download Data