Updated 2023-05-06


    with projects as
    (
    select token_id as ti , project_name as pn from ethereum.core.dim_nft_metadata
    )
    , nfts as
    (
    select tx_hash , price_usd , tx_fee_usd , creator_fee_usd
    , platform_fee_usd , total_fees_usd , block_timestamp , tokenid
    from ethereum.core.ez_nft_sales
    where block_timestamp >= current_date - interval '1 month'
    )

    , nfts_projects as
    (
    select tx_hash as tx , price_usd as usd , tx_fee_usd as tx_fee
    , creator_fee_usd as creator_fee, platform_fee_usd as platform_fee , total_fees_usd as total_fees
    , pn , block_timestamp as dt
    from nfts inner join projects on ti=tokenid
    )

    , part1 as (select count(distinct tx) , sum(usd) , avg(usd) , max(usd) , median(usd)
    from nfts_projects)

    , part1_chart as (select count(distinct tx) , sum(usd) , avg(usd) , max(usd) , median(usd)
    , trunc(dt, 'week')
    from nfts_projects
    group by 6)

    , part1_fees as (select sum(creator_fee),sum(platform_fee),sum(tx_fee)
    from nfts_projects)

    , part1_fees_chart as (select sum(creator_fee),sum(platform_fee),sum(tx_fee) , trunc(dt, 'week')
    from nfts_projects
    group by 4)