Flipside Community2a) popular apps among new users ethereum
    Updated 2024-05-29
    -- forked from 2a) popular apps among new users @ https://flipsidecrypto.xyz/edit/queries/55a92b86-1d0c-4bd8-920d-4c95a2745bce

    -- forked from 2a) popular apps among new users @ https://flipsidecrypto.xyz/edit/queries/956394e3-fe4f-4801-b8b3-68e508994b63

    with addresses as
    (
    select from_address, min(block_timestamp) as first_transaction_sent
    from ethereum.core.fact_transactions
    group by from_address
    having first_transaction_sent >= '{{Start_date}}'
    ),
    all_transactions as
    (
    select * from ethereum.core.fact_transactions
    where 1=1
    and block_timestamp >= '{{Start_date}}'
    and from_address in ( select from_address from addresses)
    ),
    top_200 as (
    select dl.label as project_name,
    count(distinct ft.from_address) as number_of_users,
    row_number() over (order by number_of_users desc) as rn
    from all_transactions ft
    inner join ethereum.core.dim_labels dl
    on ft.to_address=dl.address
    where dl.label_type not in ('token','cex','chadmin')
    group by dl.label
    order by number_of_users desc
    limit 200
    )

    select project_name,number_of_users from top_200 where rn<10
    union
    select 'others' as project_name,sum(number_of_users) as total from top_200 where rn>=10


    QueryRunArchived: QueryRun has been archived