Query editor
-- part of a query repo-- query name: Average Properties per Portfolio-- query link: https://dune.com/queries/PLACEHOLDER-- Average number of distinct properties (tokens) held per portfolio-- Uses uploaded CSV data from Fabrica's subgraph-- Only counts valid tokens with positive balancesWITH holder_property_counts AS (SELECTh.holder_address,COUNT(DISTINCT h.token_id) AS properties_heldFROM dune.fabrica.dataset_fabrica_token_holders hINNER JOIN dune.fabrica.dataset_fabrica_tokens t ON h.token_id = t.token_idWHERE CAST(h.balance AS INTEGER) > 0AND t.is_valid = trueAND CAST(t.supply AS INTEGER) > 0GROUP BY h.holder_address)SELECTROUND(AVG(properties_held), 2) AS "Average Properties per Portfolio"FROM holder_property_counts