sofiatUntitled Query
    Updated 2022-11-21
    select date_trunc('hour', block_timestamp) as hourly_time, count(*) as txn, count(distinct from_address) as unique_address
    from polygon.core.fact_transactions
    where block_timestamp :: Date >= '2022-07-01'
    group by hourly_time
    order by hourly_time
    select date_trunc('hour', block_timestamp) as hourly_time, count(distinct from_address) as new_user_count
    from
    (select a.block_timestamp, a.from_address
    from polygon.core.fact_transactions as a
    join (select b.from_address, min(block_timestamp) as first_occurence
    from polygon.core.fact_transactions
    group by b.from_address
    having first_occurence >= '2022-07-01') b
    on a.from_address = b.from_address
    and
    a.block_timestamp = b.first_occurence)
    group by hourly_time

    SELECT DATE_TRUNC('HOUR',BLOCK_TIMESTAMP) AS XDATE, COUNT( DISTINCT FROM_ADDRESS) N_NEW_USERS FROM
    (
    SELECT A.BLOCK_TIMESTAMP , A.FROM_ADDRESS
    FROM POLYGON.CORE.FACT_TRANSACTIONS AS A
    JOIN (
    SELECT FROM_ADDRESS, MIN(BLOCK_TIMESTAMP) FIRST_OCCURRENCE
    FROM POLYGON.CORE.FACT_TRANSACTIONS
    GROUP BY FROM_ADDRESS HAVING FIRST_OCCURRENCE>='2022-07-01'
    ) AS B ON A.FROM_ADDRESS = B.FROM_ADDRESS AND A.BLOCK_TIMESTAMP = B.FIRST_OCCURRENCE
    )
    GROUP BY XDATE ORDER BY XDATE


    Run a query to Download Data