DiamondFlowty Daily Sales
    Updated 2023-11-15
    SELECT
    TO_DATE(
    DATE_TRUNC(
    'day',
    CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', block_timestamp)
    )
    ) AS "Date Timestamp",
    CASE
    WHEN EVENT_CONTRACT = 'A.3cdbb3d569211ff3.NFTStorefrontV2' THEN 'Flowty'
    ELSE 'Other Contract'
    END AS "Contract",
    COUNT(*) as "Transaction Count",
    COUNT(DISTINCT event_data:buyer::string) AS unique_buyers,
    SUM(event_data:salePrice::float) AS total_sale_price,
    SUM(event_data:commissionAmount::float) AS total_commission,
    SUM(SUM(event_data:commissionAmount::float)) OVER (
    PARTITION BY
    EVENT_CONTRACT
    ORDER BY
    TO_DATE(
    DATE_TRUNC(
    'day',
    CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', block_timestamp)
    )
    )
    ) AS running_total_commission,
    SUM(SUM(event_data:salePrice::float)) OVER (
    PARTITION BY
    EVENT_CONTRACT
    ORDER BY
    TO_DATE(
    DATE_TRUNC(
    'day',
    CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', block_timestamp)
    )
    )
    Run a query to Download Data