Queries

Activity

Active hosts, collectives and backers per month

SELECT 
    to_char(date_trunc('month', t."createdAt"), 'YYYY-mm') as "month", 
    COUNT(DISTINCT(t."HostCollectiveId")) as "activeHosts", 
    COUNT(DISTINCT(t."CollectiveId")) as "activeCollectives",
    COUNT(DISTINCT(t."FromCollectiveId")) as "activeBackers"
FROM "Transactions" t

LEFT JOIN "Collectives" c On (t."CollectiveId" = c.id AND c.type LIKE 'COLLECTIVE')

WHERE t."deletedAt" IS NULL AND ((t."OrderId" IS NOT NULL AND t.type LIKE 'CREDIT') 
    OR (t."ExpenseId" IS NOT NULL AND t.type LIKE 'DEBIT')) AND
    t."createdAt" BETWEEN '2016/01/01' AND '2019/01/01'
GROUP BY "month" ORDER BY "month"

per year with total donations and platform fees per currency (USD and EUR):

SELECT 
    to_char(date_trunc('year', t."createdAt"), 'YYYY') as "year", 
    COUNT(DISTINCT(t."HostCollectiveId")) as "activeHosts", 
    COUNT(DISTINCT(t."CollectiveId")) as "activeCollectives",
    COUNT(DISTINCT(t."FromCollectiveId")) as "activeBackers",
    SUM(
    CASE WHEN t."OrderId" IS NOT NULL AND t.type='CREDIT' AND t.currency = 'USD' THEN t.amount / 100
    END
    ) as "totalDonations (USD)",
    SUM(
    CASE WHEN t."OrderId" IS NOT NULL AND t.type='CREDIT' AND t.currency = 'EUR' THEN t.amount / 100
    END
    ) as "totalDonations (EUR)",
    SUM(
    CASE WHEN t."OrderId" IS NOT NULL AND t.type='CREDIT' AND t.currency = 'USD' THEN -t."platformFeeInHostCurrency" / 100
    END
    ) as "Platform fee (USD)",
    SUM(
    CASE WHEN t."OrderId" IS NOT NULL AND t.type='CREDIT' AND t.currency = 'EUR' THEN -t."platformFeeInHostCurrency" / 100
    END
    ) as "Platform fee (EUR)"
FROM "Transactions" t

LEFT JOIN "Collectives" c On (t."CollectiveId" = c.id AND c.type LIKE 'COLLECTIVE')

WHERE t."deletedAt" IS NULL
AND ((t."OrderId" IS NOT NULL AND t.type LIKE 'CREDIT') 
    OR (t."ExpenseId" IS NOT NULL AND t.type LIKE 'DEBIT'))
GROUP BY "year" ORDER BY "year"

Active backers per month

Total (cumulative backers) up to a date

Collectives active (any txn) after 3 months, per monthly cohort

For all the collectives created in a given month, how many of them are still active after 3 months?

Collectives active (expenses-only) after 3 months, per monthly cohort

For all the collectives created in a given month, how many of them are still active after 3 months?

Monthly subscriptions active after 3 months, per monthly cohort

For all the monthly subscriptions that started in a given month, how many are still active after 3 months?

Measure activated and deactivated Subs per month

Top collectives of a month

Top new collectives of a month

Top collectives by number of new backers

Top backers of a month

All sponsors (all months)

Total contributions from new sponsors Vs. old sponsors per month

Note: you can limit this view to one single currency by adding WHERE old.currency = 'USD':

New sponsors created

Total $ received per collective (all months)

New collectives created

Revenue calcs

Revenue and transaction splits by month with all currencies converted to USD

Monthly gross revenue, split by currency

Monthly gross revenue, split by recurring vs one-time

Fees by group by month for all donations.

Note: it doesn't include expenses (yet).

Active collectives in a month and how much they paid in fees.

You'll need to update the month start and end dates to run it for a particular month and update %name for different organizatons.

Other

Amount we are holding for collectives at any given moment

Change UserId to other hosts to find out for anyone else.

Estimate how many subscriptions are marked active but haven't had a transaction in last 30 days

Last updated