jp12[FLOW] Top Shots Play Type - Sales Volume
    Updated 2022-08-15
    WITH raw as (
    SELECT *
    FROM flow.core.fact_nft_sales s INNER JOIN flow.core.dim_topshot_metadata USING (NFT_COLLECTION, nft_id)
    WHERE TX_SUCCEEDED = 'TRUE'
    )

    SELECT block_timestamp::date as date, play_type, COUNT(DISTINCT tx_id) as num_tx, SUM(num_tx) OVER (PARTITION BY play_type ORDER BY date ASC) as total_tx,
    SUM(PRICE) as daily_sales, SUM(daily_sales) OVER (PARTITION BY play_type ORDER BY date ASC) as total_sales
    FROM raw
    GROUP BY 1, 2
    Run a query to Download Data