Afonso_Diazgrouping by label
    Updated 2024-08-30
    with

    transactions as (
    select
    tx_id,
    block_timestamp,
    a.event_contract as contract_address,
    c.authorizers[0] as user
    from flow.core.fact_events a
    join flow.core.fact_transactions c
    using (tx_id, tx_succeeded)
    where tx_succeeded = 1
    and block_timestamp::date >= current_date - interval '1 month'
    )

    select
    label_type,
    count(distinct contract_address) as contracts,
    count(distinct tx_id) as transactions,
    count(distinct user) as users
    from transactions
    join flow.core.dim_labels
    on address = contract_address
    where block_timestamp::date between '{{ start_date }}' and '{{ end_date }}'
    group by 1
    order by transactions desc
    limit 10


    QueryRunArchived: QueryRun has been archived