Flipside CommunityPolygon Returning Addresses
    Updated 2025-02-04
    with distinct_interaction_years AS(
    select from_address, substr(date_trunc('year',block_timestamp),0,4) as year, count(distinct from_address) as "yes" from polygon.core.fact_transactions
    group by 1,2
    ),
    pivoted_table as
    (
    SELECT *
    FROM (
    SELECT from_address, year, COUNT("yes") as yes_count
    FROM distinct_interaction_years
    GROUP BY from_address, year
    )
    PIVOT (
    MAX(yes_count) FOR year IN (2020,2021,2022, 2023)
    )
    )

    select '2020' as year, count(from_address) as addresses from pivoted_table
    where 1=1
    and "2020"='1'

    union
    select '2021' as year, count(from_address) as addresses from pivoted_table
    where 1=1
    and "2021"='1'

    union

    select '2022' as year, count(from_address) as addresses from pivoted_table
    where 1=1
    and "2022"='1'

    union

    select '2023' as year, count(from_address) as addresses from pivoted_table
    Last run: 3 months ago
    YEAR
    ADDRESSES
    1
    2020111284
    2
    2020 and 20216221
    3
    2020 and 20222925
    4
    2020 and 20232599
    5
    2020, 2021 and 20222415
    6
    2020, 2021 and 20232334
    7
    2020, 2021, 2022 and 20231643
    8
    2020, 2022 and 20231727
    9
    20217109271
    10
    2021 and 20221806486
    11
    2021 and 2023779028
    12
    2021, 2022 and 2023593097
    13
    202222139259
    14
    2022 and 20235071850
    15
    202332783892
    15
    369B
    317s