Tables and columns in the analytics BigQuery dataset.
Click a table in the sidebar to filter, or search below.
| Table ↕ | Column ↕ | Type ↕ | Description ↕ |
|---|
The Cubby data warehouse is the analytics BigQuery dataset that mirrors your
operational data — facilities, units, leases, contacts, payments, communications, and more
— remodeled for analytics and reporting. Tables are denormalized with descriptive columns
and foreign keys, so you can join across the business without reconstructing the underlying
transactional schema.
Data is refreshed on a rolling schedule:
spaces_historical and ga_events are refreshed once per day.Open Tables to browse every table and column, Schema Diagram to explore how the tables relate, or Sample queries for worked examples you can copy and run. Change log lists what has changed in the warehouse, newest first, and the notable changes that are coming up.
sparefoot_reservations will be retired. Use market_aggregator_reservations, which has the same columns (see November 20).market_aggregator_reservations replaces sparefoot_reservations: one row per reservation booked through a market aggregator marketplace, linked to the lead it created. Renter contact details are not included; join to leads for them. It has exactly the same columns as sparefoot_reservations, so switching is a change of table name only: org_id, sparefoot_reservation_id, reservation_code, sparefoot_reservation_number, facility_id, facility_name, lead_id, status, reserved_at, move_in_date, width, depth, price, features, move_in_confirm_requested_at, created_at and updated_at.sparefoot_reservations will be retired on December 4, 2026. Move queries to market_aggregator_reservations before then.call_outcomes and the call_child changes below became available on November 20.
call_outcomes: one row per inbound Calls+ call, with one answer to whether it was handled, by whom, and if not, why not. Use outcome instead of calls.status for answer and abandon rates: calls.status marks some callers who paid by phone and then hung up as abandoned. Spoke calls are not included.call_center_tasks: one row per call waiting in one team’s queue. A call that rolls from one team to another (for example from a facility to the call center) has one row per team. Shows how long it waited, how many agents or desk phones it was offered to, who answered, and why it ended.call_tree_runs: one row per time a call went through a Calls+ call tree (IVR), with the menu choices the caller made and whether it reached a queue, voicemail or phone payment.call_tree_steps: one row per step a call took through a call tree, including the key pressed at each menu and the branch taken next.call_tree_menu_options: one row per call-tree version, menu and key, labeled with where each key leads. Use it to decode call_tree_steps.menu_digit_pressed.call_trees: one row per Calls+ call tree, with its current name, status and version.call_agent_status_log: one row per agent status change, for Spoke and Calls+ agents, with when each status started and ended. call_agent_availability is its daily rollup.call_missed_team_snapshot: one row per unanswered Calls+ queue task and each agent who could have taken it, with what each agent was doing when the call entered and left the queue, and whether the call was offered to them. Team membership is current, not historical.calls: provider (FLEX for Calls+, or SPOKE) and ended_by (who ended the call; recorded from November 12, 2026, NULL for earlier calls).call_child: provider.call_center_reservations: call_center_task_id and team_id, offer_target_type (AGENT or DESK_PHONE), offer_sequence, agent_offer_attempt, offer_outcome and ring_seconds.call_agent_availability: status_category and custom_status_name (for example Lunch or Coaching).call_agent_availability.status_name now covers Calls+ statuses, which were NULL before.call_child.abandoned for inbound Calls+ calls now comes from call_outcomes, so callers who paid by phone and then hung up are no longer counted as abandoned. Spoke calls are unchanged.call_center_reservations: offers to a desk phone now carry the desk phone’s facility.calls.option_selected_type is now described as Spoke-only. It is NULL for Calls+ calls; use call_tree_runs or call_tree_steps for menu choices.storefront_pricing_groups now has a row for every unit type on every storefront that carries its facility, published or not. Before, a unit type only appeared once someone had customized it in the storefront builder, so many unit types on live storefronts were missing. Rows for unit types that were never customized carry the app’s defaults. The table is about five times larger. Filter on is_listed = 1 for unit types available on a live storefront.storefront_pricing_groups: has_storefront_settings, is_published, is_listed and is_api_storefront (the storefront the External API serves the facility from).storefront_pricing_groups.is_active is the operator’s on/off switch only; it does not account for whether the storefront or facility is published. Use is_listed for that.lease_compliance: submitted_at and approved_at — when each document was signed or uploaded, and when it was approved, in facility local time. Approval times before July 2025 are only known for documents approved on upload.lease_compliance: one row per lease per required document group (lease agreement, coverage, identity, vehicle) or added document, with its compliance status, as shown in the app.payment_methods: one row per saved card or bank account, with type, brand, last four, expiration and whether it pays a lease on autopay. Payment tokens and billing addresses are not included.lease_configurations: one row per lease configuration, with its deposit, move-in and payment fees, rent-increase cap, delinquency and lien timeline, and required tenant details.coverage_programs and coverage_levels: the organization’s insurance and protection-plan programs and their coverage levels, with premiums and payouts.facility_schedules: one row per facility schedule per weekday, with open and close times and whether it is the facility’s office hours or phone support hours.storefront_pricing_groups: one row per unit type shown on a storefront, with its display name, description, booking option and photo count.| Table | Columns added |
|---|---|
leases | updated_at, pg_id, unit_contents, next_charge_date, autopay_payment_method_id, ins_coverage_level_id, ins_coverage_start_date, ins_private_policy_number, is_ins_autoenrollable, ins_scheduled_coverage_type, ins_scheduled_coverage_level_id, ins_scheduled_coverage_level, ins_scheduled_premium, legacy_id |
leads | message, custom_source, ins_coverage_type, reserved_at, unqualified_at, legacy_id |
contacts | email_comm_preference_source, sms_comm_preference_source, is_email_undeliverable, is_sms_undeliverable, legacy_id |
units | unit_area, unit_volume, walkthrough_order, value_pricing_tier, is_reserved, lease_id, legacy_id |
pricing_group | area, is_vehicle_storage, is_parking, lease_configuration_id, coverage_program_id, value_pricing_status, available_units, reservations_count, is_overbooking_allowed, rentable_units |
manager_notes | manager_note_id, manager_id, contact_id, lease_id, lead_id, unit_id, task_id, pg_id, delinquency_exemption_id, facility_id |
facilities | payment_service_provider |
book_entries | lease_auction_id |
facility_groups | facility_group_id |
auctions | lease_configuration_id |
lease_auctions | remaining_bid |
tasks | updated_at |
manager_notes now has one row per note. Notes not on a contact (for example on a task or unit type) are included, and identical notes are no longer collapsed, so row counts are higher.sms_conversations: one row per tenant or lead SMS conversation, with whether it is resolved, whether a person has taken it over from the AI agent, and who last resolved it.sms_conversation_resolutions: one row each time an SMS conversation was marked resolved or reopened, with who did it, so resolutions by the AI agent can be compared with resolutions by staff.workflow_runs: one row per run of an automated workflow (the texts, emails and tasks triggered by an overdue lease, a new lead or reservation, or a move-in or move-out), with the lease or lead that started it and how far it got. Emails, SMS and tasks sent by a run carry its workflow_run_id.ai_call_outcomes: one row per call answered by the AI voice agent, with what it got done: leads and leases created, move-outs scheduled, and handoffs to staff or the payment line.call_center_reservations: one row each time the call-center queue offered a call to an agent, with the queue, the agent, whether they accepted, and any transfer. A call that rings several agents has several rows.sparefoot_reservations: one row per reservation booked through the SpareFoot marketplace, linked to the lead it created. Renter contact details are not included; join to leads for them. Note: Table replaced with “market_aggregator_reservations” on Nov 20 (see entry for Nov 20). “sparefoot_reservations” will be retired on Dec 4.value_pricing_strategy_tiers: one row per tier (LOWEST, MEDIUM, HIGHEST) of each value pricing strategy, with the tier’s name, price increase and listed benefits.leases: ecri_recommended_rate and ecri_recommended_at — Cubby’s current recommended rent for the lease’s next ECRI increase, and when it was made. Only the latest recommendation is kept.pricing_group: value_pricing_strategy_id, which joins to value_pricing_strategy_tiers.stor_track: year_built, total_sqft and rentable_sqft.call_agent_availability: time_zone, the time zone day is bucketed in.call_agent_availability.day is now bucketed in the organization’s call-center time zone instead of America/New_York. Organizations without a call-center time zone are unchanged.insurance_policies: one row per insurance or protection-plan policy on a lease, current and past. A lease gets a new policy each time its coverage level changes, so consecutive rows show enrollments, upgrades and downgrades over time.insurance_coverage_changes: one row per coverage change scheduled on a lease — a new coverage level, a switch to the tenant’s own insurance, or opting out. Each change is applied on the lease’s next rent date, when the matching insurance_policies row starts.payment_requests: one row per request to waive a charge, write off or refund a balance, or refund a payment, with who requested it, who approved or rejected it, and why.payouts: one row per attempted bank payout of a facility’s Cubby Payments balance, including failed and skipped attempts. Only organizations on Cubby Payments have rows.lien_notices: one row per lien notice sent by email, SMS or physical mail, with USPS mailing and tracking details for mailed notices. Recipient names and mailing addresses are not included.retail_sales: one row per merchandise line sold or returned at a facility (boxes, locks, packing supplies), with revenue and cost of goods for margin reporting.facility_products: one row per product stocked at a facility, with the facility’s price and cost and the current stock on hand.door_locks: one row per lock in the organization’s lock inventory, with its current status, unit and maintenance flag. Lock combinations are not included.door_lock_history: one row per change to a lock, with its status, facility and unit before and after the change and the manager who made it. Lock combinations are not included.unit_walkthrough: walkthrough_id, walkthrough_date, walkthrough_completed_at, viewed_by_manager_id and viewed_by_manager_name.payments: payout_id, which joins to payouts so bank deposits can be matched to the payments behind them.lease_auctions: lease_auction_id.| Table | Columns added |
|---|---|
leases | ins_coverage_type, ins_private_policy_expiration_date, is_imported, billing_cycle, is_tax_exempt, documents_combined_status, lead_id, transferred_to_lease_id, is_gate_lockout_needed, active_delinquency_exemption_id, balance_credit, effective_rate, is_eligible_for_rent_increase |
spaces_historical | ins_coverage_type, ins_private_policy_expiration_date |
facilities | city, state, zip, country, facility_email, website_link, currency, is_enabled |
book_entries | is_manual, accrual_end, fee_id, fee_name, product_id, quantity, ins_coverage_level, initial_book_entry_id |
payments | item_type, failed_reason, original_payment_id, per_authorization_fee, volume_fee, dispute_or_return_fee |
rate_changes | rent_change_notice_date, is_rent_change_notice_sent, rent_change_manager_id, rent_change_manager_name |
leads | last_activity_at, rate_type, custom_rate, discount_strategy_ids, discount_strategy_names, ins_premium, ins_coverage_level |
calls | summary |
emails | is_system, workflow_run_id, workflow_name, bounce_type |
sms | is_system, workflow_run_id, workflow_name, service_phone_number |
tasks | schedule, unit_id, contact_id, workflow_run_id, workflow_name |
delinquency_exemptions: one row per active delinquency exemption — a manager-set hold that pauses some or all of a delinquent lease’s collections steps until an end date. Removed, replaced and expired exemptions are not included.marketing_numbers: one row per marketing (external or tracking) phone number and the facility it is assigned to. Joins to calls on calls.forwarded_from = number within the same org_id.calls: campaign_label.call_child: has_recording.facilities: billing_cycle and billing_option.units: unit_description and updated_at.manager_roles: one row per role a manager holds at a facility or across the organization, with that role’s permissions.pricing_group_discount_strategies: one row per discount strategy assigned to a pricing group.rate_change_plans: one row per ECRI rate-increase plan (e.g. “6 - 6 - 6 plan”), with its increase intervals. Joins to leases.rate_change_plan_id.leases: the lease’s rate plan
(rate_change_plan_id, rate_change_plan_name) and its intervals
(rate_change_plan_first_change_months, rate_change_plan_subsequent_change_months);
the facility’s default plan (facility_rate_change_plan_name);
ecri_stage (the app’s own READY / IN_REVIEW / SCHEDULED / SNOOZED / SET);
estimated_next_rent_change_date; and rent_change_snoozed_until_date.
managers: manager_persona and manager_status.leads: created_by_manager_id and converted_by_manager_id, which join to managers.manager_id.pricing_group: value_pricing_strategy_name (NULL when value pricing is off).managers.manager_permissions was always NULL. Role permissions are now in manager_roles.permissions.unit_turnover.pg_target_rate and rate_changes.target_rate now state that they hold the pricing group’s current target, not its value at the time of the event.
Eleven worked examples covering occupancy, leasing velocity, marketing attribution,
tenure, collections, and revenue management. Every query here has been run against
production data. Each one opens with DECLARE statements — set
target_org to your org_id (query 0 finds it) and adjust the
dates, then run.
org_idSix things about this data that are easy to get wrong.
org_id, and filter date on
spaces_historical. Every table is clustered on
org_id; spaces_historical and ga_events are
also date-partitioned. Your access is already scoped to your organization, so these
filters do not change your results — they cut the data scanned, which makes
queries faster and cheaper.
spaces_historical is a daily snapshot — one row
per unit per day, with no missing days. Use it for anything historical or trended.
units holds current state only.
is_active = 1 means the unit is in
inventory (0 is retired — exclude it from denominators);
is_occupied = 1 is exactly equivalent to
lease_id IS NOT NULL; and is_unrentable means the unit
cannot be rented right now. A unit can be both occupied and unrentable, so
unrentable is not the same as vacant.
width * depth, and parking breaks it.
Parking spaces usually store width = 0, so their area computes to zero.
Every square-foot query below returns a units_missing_dimensions column
so you can see how much of the site is affected before trusting the percentage.
0001, 2108, 5026), so always bound date ranges
explicitly.
rate_changes.rent_change_amount is the new rent, not the size of
the increase. leads.age_of_lead_minutes is now minus
created_at, recomputed on every load — not time to resolution, and it keeps
growing after a lead closes.
Every other query on this page needs your org_id. This is the quickest way
to get it.
SELECT DISTINCT org_id FROM `cubby-partner-data.analytics.facilities` ORDER BY org_id;
org_id —
or a small handful if you manage several organizations. You are not seeing anyone
else's data, and you do not need the filter for privacy.
org_id. Adding WHERE org_id = '…' lets
BigQuery skip the blocks belonging to other organizations instead of reading and then
discarding them. Same rows out, far less data processed, and noticeably faster on the
large tables.
facilities is one of the smallest tables in the dataset, which makes it
the cheapest place to look this up.
SELECT org_id, COUNT(*) AS facilities FROM … GROUP BY org_id.
Month-end physical occupancy on both a unit and a square-foot basis.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
DECLARE start_date DATE DEFAULT DATE '2025-01-01';
DECLARE end_date DATE DEFAULT CURRENT_DATE();
WITH snap AS (
SELECT
sh.date,
DATE_TRUNC(sh.date, MONTH) AS month,
sh.facility_id,
sh.facility_name,
sh.is_occupied,
sh.is_unrentable,
sh.width * sh.depth AS sqft
FROM `cubby-partner-data.analytics.spaces_historical` sh
WHERE sh.org_id = target_org
AND sh.date BETWEEN start_date AND end_date
AND sh.is_active = 1 -- exclude retired units
),
month_end AS (
-- Latest snapshot in each month, so a partial current month uses the most recent day
SELECT month, MAX(date) AS as_of_date
FROM snap
GROUP BY month
),
eom AS (
SELECT s.*
FROM snap s
JOIN month_end m ON s.month = m.month AND s.date = m.as_of_date
)
SELECT
month,
MAX(date) AS as_of_date,
facility_name,
COUNT(*) AS units_total,
COUNTIF(is_occupied = 1) AS units_occupied,
ROUND(SAFE_DIVIDE(COUNTIF(is_occupied = 1), COUNT(*)) * 100, 1) AS unit_occupancy_pct,
-- Denominator excludes units that are vacant AND unrentable
ROUND(SAFE_DIVIDE(COUNTIF(is_occupied = 1),
COUNTIF(is_occupied = 1 OR NOT is_unrentable)) * 100, 1)
AS rentable_unit_occupancy_pct,
ROUND(SUM(sqft), 0) AS sqft_total,
ROUND(SUM(IF(is_occupied = 1, sqft, 0)), 0) AS sqft_occupied,
ROUND(SAFE_DIVIDE(SUM(IF(is_occupied = 1, sqft, 0)), SUM(sqft)) * 100, 1) AS sqft_occupancy_pct,
COUNTIF(sqft IS NULL OR sqft = 0) AS units_missing_dimensions
FROM eom
GROUP BY month, facility_name
ORDER BY month DESC, facility_name;
unit_occupancy_pct covers all units in inventory — the standard
external-reporting number. rentable_unit_occupancy_pct removes
vacant-and-unrentable units from the denominator, which is the fairer read on how
the site is actually selling.
units_missing_dimensions before quoting
sqft_occupancy_pct. If it is a large share of
units_total, the square-foot figure only describes part of the site.
month_end and
eom CTEs and group snap directly by month,
so every day contributes equally.
Current occupancy and pricing by sellable unit type, with in-place rent against street rate.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
DECLARE as_of DATE DEFAULT (
SELECT MAX(date) FROM `cubby-partner-data.analytics.spaces_historical`
);
SELECT
sh.facility_name,
sh.pricing_group_name AS unit_type,
CONCAT(CAST(sh.width AS STRING), 'x', CAST(sh.depth AS STRING)) AS size,
COUNT(*) AS units_total,
COUNTIF(sh.is_occupied = 1) AS units_occupied,
COUNTIF(sh.is_occupied = 0 AND NOT sh.is_unrentable) AS units_vacant_rentable,
COUNTIF(sh.is_occupied = 0 AND sh.is_unrentable) AS units_vacant_unrentable,
ROUND(SAFE_DIVIDE(COUNTIF(sh.is_occupied = 1), COUNT(*)) * 100, 1) AS unit_occupancy_pct,
ROUND(AVG(sh.street_rate), 2) AS avg_street_rate,
ROUND(AVG(IF(sh.is_occupied = 1, sh.occ_rate, NULL)), 2) AS avg_in_place_rate,
ROUND(SAFE_DIVIDE(AVG(IF(sh.is_occupied = 1, sh.occ_rate, NULL)),
AVG(sh.street_rate)) * 100, 1) AS in_place_vs_street_pct
FROM `cubby-partner-data.analytics.spaces_historical` sh
WHERE sh.org_id = target_org
AND sh.date = as_of
AND sh.is_active = 1
GROUP BY 1, 2, 3
HAVING units_total >= 5 -- suppress thin cells
ORDER BY facility_name, units_total DESC;
pricing_group_name is the unit type you want
(Drive-up 10x20, Climate-Controlled 5x10,
Parking - Uncovered 30'). The units.unit_type column has
only three values — RENT_ENCLOSED_STORAGE,
RENT_PARKING_SPACE, RENT_MOBILE_STORAGE — and is not
reliably maintained; parking pricing groups are sometimes tagged as enclosed
storage. Treat it as a rough category at best.
in_place_vs_street_pct above 100% means existing tenants pay more than
the current asking rate, which is normal for a site with a mature rate-increase
program. Below 100% is loss to lease: sustained readings there, especially on a type
sitting near full, usually mean street rates are set too low.
as_of filter for a BETWEEN range and add
DATE_TRUNC(sh.date, MONTH) to the grouping to trend any of this over
time.
Tenure by cohort, with the pre-migration history problem handled.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
WITH history_start AS (
-- The earliest move-out ever recorded for this org, which approximates the
-- migration/go-live date. Move-outs before this date are absent from the data,
-- so cohorts starting earlier contain only migration survivors.
SELECT DATE_TRUNC(MIN(lease_ended), MONTH) AS first_observable_month
FROM `cubby-partner-data.analytics.leases`
WHERE org_id = target_org
AND lease_ended > DATE '2015-01-01' -- guard against junk dates
),
cohort AS (
SELECT
DATE_TRUNC(l.lease_started, MONTH) AS move_in_month,
l.lease_ended IS NOT NULL AS has_moved_out,
DATE_DIFF(IFNULL(l.lease_ended, CURRENT_DATE()), l.lease_started, DAY) AS days_observed
FROM `cubby-partner-data.analytics.leases` l
CROSS JOIN history_start h
WHERE l.org_id = target_org
AND l.lease_started >= h.first_observable_month
AND l.lease_started <= CURRENT_DATE()
)
SELECT
move_in_month,
COUNT(*) AS move_ins,
COUNTIF(has_moved_out) AS moved_out,
ROUND(SAFE_DIVIDE(COUNTIF(has_moved_out), COUNT(*)) * 100, 1) AS pct_moved_out,
ROUND(APPROX_QUANTILES(IF(has_moved_out, days_observed, NULL), 2)[OFFSET(1)] / 30.44, 1)
AS median_los_months,
ROUND(AVG(IF(has_moved_out, days_observed, NULL)) / 30.44, 1) AS avg_los_months,
IF(SAFE_DIVIDE(COUNTIF(has_moved_out), COUNT(*)) >= 0.5,
'complete',
'incomplete - fewer than half have moved out') AS cohort_status
FROM cohort
GROUP BY move_in_month
ORDER BY move_in_month DESC;
median_los_months where
cohort_status = 'complete'. For recent cohorts most tenants are
still in place, so the median of those who have left is a median of early leavers
only — badly biased downward. A cohort's median means something exactly when at
least half of it has moved out.
complete row for the real number.
avg_los_months runs well above the median because a minority of very
long tenancies pull the mean up. Median is the better headline; the gap between the
two tells you about your long-tail tenants.
history_start guard already
excludes the cohorts where their move-outs are missing. Adding
AND lease_created_by <> 'IMPORT' would truncate your history back
to go-live and throw away real tenure data.
first_observable_month per facility. To be strict, compute
history_start grouped by facility_id and join on it.
Monthly move-in volume split by how the customer found you and how they signed.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
DECLARE start_date DATE DEFAULT DATE '2025-01-01';
DECLARE end_date DATE DEFAULT CURRENT_DATE();
WITH move_ins AS (
SELECT
DATE_TRUNC(l.lease_started, MONTH) AS move_in_month,
CASE
WHEN l.lease_created_by = 'WEBSITE' THEN 'Online (self-serve)'
WHEN l.lease_created_by = 'IMPORT' THEN 'Imported / migrated'
ELSE 'Manager-assisted'
END AS rental_channel,
IFNULL(ld.lead_source, '(no lead record)') AS lead_source,
l.lease_rent_original
FROM `cubby-partner-data.analytics.leases` l
LEFT JOIN `cubby-partner-data.analytics.leads` ld
ON ld.org_id = l.org_id
AND ld.converted_lease_id = l.lease_id
WHERE l.org_id = target_org
AND l.lease_started BETWEEN start_date AND end_date
)
SELECT
move_in_month,
rental_channel,
lead_source,
COUNT(*) AS move_ins,
ROUND(SAFE_DIVIDE(COUNT(*), SUM(COUNT(*)) OVER (PARTITION BY move_in_month)) * 100, 1)
AS pct_of_month,
ROUND(AVG(lease_rent_original), 2) AS avg_move_in_rent
FROM move_ins
GROUP BY move_in_month, rental_channel, lead_source
ORDER BY move_in_month DESC, move_ins DESC;
lease_created_by is your rental-channel field.
WEBSITE is an online self-serve rental, IMPORT came from a
prior system or a bulk load, and any other value is a staff member's name — a
manager-assisted rental.
leads.converted_lease_id joins to leases.lease_id one to
one. Coverage is roughly 99% of online rentals and 92% of manager-assisted ones; the
rest appear as (no lead record).
CALL lead that closes as Online (self-serve) means the
customer phoned and then rented on their own — a different operational story
from a call the manager closed. The split shows where staff time is actually
converting.
Imported / migrated rows are not real move-ins for the month; they are
artifacts of a data load. Exclude them when reporting leasing velocity, or use query
5, which avoids the issue.
avg_move_in_rent uses lease_rent_original, the contract
rent at signing before any promotional discount. For actual first-month revenue,
join discounts on lease_id.
Leasing velocity from the purpose-built turnover table.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
DECLARE start_date DATE DEFAULT DATE '2025-01-01';
DECLARE end_date DATE DEFAULT CURRENT_DATE();
SELECT
DATE_TRUNC(move_date, MONTH) AS month,
facility_name,
COUNTIF(move_type = 'MOVE_IN') AS move_ins,
COUNTIF(move_type = 'MOVE_OUT') AS move_outs,
COUNTIF(move_type = 'MOVE_IN') - COUNTIF(move_type = 'MOVE_OUT') AS net_absorption_units,
COUNTIF(move_type = 'TRANSFER') AS internal_transfers,
ROUND(SUM(IF(move_type = 'MOVE_IN', unit_width * unit_depth, 0)), 0) AS sqft_moved_in,
ROUND(SUM(IF(move_type = 'MOVE_OUT', unit_width * unit_depth, 0)), 0) AS sqft_moved_out,
ROUND(AVG(IF(move_type = 'MOVE_IN', lease_rent, NULL)), 2) AS avg_move_in_rent,
ROUND(AVG(IF(move_type = 'MOVE_OUT', lease_rent, NULL)), 2) AS avg_move_out_rent,
ROUND(APPROX_QUANTILES(IF(move_type = 'MOVE_OUT', lease_days_rented, NULL), 2)[OFFSET(1)], 0)
AS median_days_rented_of_move_outs
FROM `cubby-partner-data.analytics.unit_turnover`
WHERE org_id = target_org
AND move_date BETWEEN start_date AND end_date
GROUP BY month, facility_name
ORDER BY month DESC, move_ins DESC;
unit_turnover over deriving move-ins from
leases. It holds one row per lease per event and already
separates internal transfers into their own TRANSFER type, so a tenant
moving from a 5x10 to a 10x10 does not inflate your move-ins and move-outs. Deriving
from lease_started and lease_ended counts both sides of
every transfer as real churn.
avg_move_in_rent against avg_move_out_rent is a rate-roll
indicator. Move-out rents are usually higher because departing tenants have absorbed
years of increases; a persistent large gap means new rentals are priced well below
what the existing base tolerates.
sqft_moved_in with sqft_moved_out catches mix
shift that unit counts hide. Flat net absorption alongside shrinking net square
footage means you are trading large units for small ones.
Which inquiries are sitting unworked, and for how long.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
WITH open_leads AS (
SELECT
IFNULL(lead_source, '(unknown)') AS lead_source,
age_of_lead_minutes / 1440.0 AS age_days
FROM `cubby-partner-data.analytics.leads`
WHERE org_id = target_org
-- Unresolved statuses only; age_of_lead_minutes is meaningless once a lead closes
AND status IN ('NEW','IN_PROGRESS_HOT','IN_PROGRESS_COLD','ON_HOLD','RESERVATION')
)
SELECT
lead_source,
COUNT(*) AS open_leads,
COUNTIF(age_days < 1) AS age_under_1d,
COUNTIF(age_days >= 1 AND age_days < 7) AS age_1_6d,
COUNTIF(age_days >= 7 AND age_days < 30) AS age_7_29d,
COUNTIF(age_days >= 30 AND age_days < 90) AS age_30_89d,
COUNTIF(age_days >= 90) AS age_90d_plus,
ROUND(APPROX_QUANTILES(age_days, 2)[OFFSET(1)], 1) AS median_age_days,
ROUND(AVG(age_days), 1) AS avg_age_days
FROM open_leads
GROUP BY lead_source
ORDER BY open_leads DESC;
age_of_lead_minutes is recomputed as now minus
created_at on every load, so a lead that converted in five minutes two
years ago reports an age of two years. Without the filter you are measuring how long
ago leads were created, not how long they have been waiting. For resolution time use
time_to_convert or time_to_unqualified.
DUPLICATE is a real status and is excluded here along with the other
closed states. It is worth reporting separately — a high duplicate rate on a
source usually means the same person is arriving through several paths.
age_90d_plus bucket is mostly dead pipeline that was never
dispositioned. Cleaning it up makes every downstream conversion rate more honest.
avg_age_days far above median_age_days for a source is the
signature of a stale tail rather than a slow process.
Conversion and speed to close, by where the lead came from.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
DECLARE start_date DATE DEFAULT DATE '2025-01-01';
-- End the window early so recent leads have had time to convert
DECLARE end_date DATE DEFAULT DATE_SUB(CURRENT_DATE(), INTERVAL 14 DAY);
WITH scored AS (
SELECT
IFNULL(lead_source, '(unknown)') AS lead_source,
status,
time_to_convert
FROM `cubby-partner-data.analytics.leads`
WHERE org_id = target_org
AND DATE(created_at) BETWEEN start_date AND end_date
AND status <> 'DUPLICATE' -- duplicates would deflate every rate
)
SELECT
lead_source,
COUNT(*) AS leads,
COUNTIF(status = 'CONVERTED') AS converted,
ROUND(SAFE_DIVIDE(COUNTIF(status = 'CONVERTED'), COUNT(*)) * 100, 1) AS conversion_pct,
COUNTIF(status = 'UNQUALIFIED') AS unqualified,
COUNTIF(status IN ('NEW','IN_PROGRESS_HOT','IN_PROGRESS_COLD','ON_HOLD','RESERVATION'))
AS still_open,
ROUND(APPROX_QUANTILES(IF(status = 'CONVERTED', time_to_convert / 60.0, NULL), 2)[OFFSET(1)], 1)
AS median_hours_to_convert,
ROUND(SAFE_DIVIDE(COUNTIF(status = 'CONVERTED' AND time_to_convert = 0),
NULLIF(COUNTIF(status = 'CONVERTED'), 0)) * 100, 1)
AS pct_converted_instantly
FROM scored
GROUP BY lead_source
HAVING leads >= 20 -- suppress thin cells
ORDER BY leads DESC;
WEBSITE_CHECKOUT records a
completed online rental — the lead row is created by the checkout, so
it converts essentially always. The same applies to WALK_IN, often
logged at the counter as the rental happens. The real prospect sources to compare
against each other are CALL, RESERVATION_FORM,
CONTACT_FORM, SPAREFOOT, and the other aggregators.
pct_converted_instantly is what separates the two groups. A high value
means the lead is a record of a rental rather than an inquiry that was worked. Read
conversion_pct alongside it, never alone.
ABANDONED_CHECKOUT and FAILED_CHECKOUT are
system-generated recovery leads, not inbound demand. Their conversion rate measures
how well you win back a dropped cart — useful, but not a marketing-channel
number. Do not roll them into a blended rate.
lead_source, not source or
marketing_source, for channel reporting.
lead_source is a clean controlled vocabulary; the other two blend that
vocabulary with raw UTM strings, so you get organic, cpc,
gbp, gpb (a typo of the same thing), and occasionally an
entire ad-set name.
end_date matters. Median time to convert is under an
hour for most sources, but CONTACT_FORM runs well over a day, so a
window ending today understates the slower channels.
Unpaid balances by facility, separating the current billing cycle from genuinely delinquent AR and aging the rest by how long the lease has been late.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
WITH active AS (
SELECT
l.facility_name,
GREATEST(IFNULL(l.balance_ar, 0), 0) AS ar,
l.is_lease_paid,
l.is_needs_overlock,
l.is_in_auction,
l.is_autopay_enabled,
-- status_late_since_date is forward-looking: on a paid or paid-ahead lease it holds the
-- NEXT date the lease goes late, so clamp negatives to 0 (still within the current cycle).
-- CURRENT_DATE() is UTC, so take the date in the facility's own time zone.
GREATEST(
DATE_DIFF(CURRENT_DATE(IFNULL(f.time_zone, 'UTC')), l.status_late_since_date, DAY),
0
) AS days_late
FROM `cubby-partner-data.analytics.leases` l
LEFT JOIN `cubby-partner-data.analytics.facilities` f
USING (org_id, facility_id)
WHERE l.org_id = target_org
AND l.is_active = 1
)
SELECT
facility_name,
COUNT(*) AS active_leases,
-- Due but not yet delinquent. Rent bills on the lease anniversary, so on any given day a
-- large share of tenants sit here simply because their cycle just turned over.
COUNTIF(is_lease_paid = 0 AND days_late <= 10) AS unpaid_current_cycle,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late <= 10, ar, 0)), 2) AS ar_0_10,
-- Delinquent: past the 10-day grace window.
COUNTIF(is_lease_paid = 0 AND days_late >= 11) AS delinquent_leases,
ROUND(SAFE_DIVIDE(COUNTIF(is_lease_paid = 0 AND days_late >= 11), COUNT(*)) * 100, 1)
AS pct_delinquent,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late >= 11, ar, 0)), 2) AS delinquent_ar,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late BETWEEN 11 AND 30, ar, 0)), 2) AS ar_11_30,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late BETWEEN 31 AND 60, ar, 0)), 2) AS ar_31_60,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late BETWEEN 61 AND 90, ar, 0)), 2) AS ar_61_90,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late BETWEEN 91 AND 120, ar, 0)), 2) AS ar_91_120,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late BETWEEN 121 AND 180, ar, 0)), 2) AS ar_121_180,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late BETWEEN 181 AND 360, ar, 0)), 2) AS ar_181_360,
ROUND(SUM(IF(is_lease_paid = 0 AND days_late > 360, ar, 0)), 2) AS ar_over_360,
ROUND(SUM(IF(is_lease_paid = 0, ar, 0)), 2) AS total_unpaid_ar,
COUNTIF(is_needs_overlock = 1) AS needs_overlock,
COUNTIF(is_in_auction = 1) AS in_auction,
ROUND(SAFE_DIVIDE(COUNTIF(is_autopay_enabled IS TRUE), COUNT(*)) * 100, 1) AS pct_on_autopay
FROM active
GROUP BY facility_name
ORDER BY delinquent_ar DESC;
ar_0_10 is split out here rather than folded into a total.
status_late_since_date is forward-looking. On a lease
that is paid, or paid ahead of its cycle, it holds the next date the lease
goes late, so a raw DATE_DIFF against it returns a negative number.
Guard every bucket with is_lease_paid = 0 and clamp with
GREATEST(…, 0), or those leases fall silently into no bucket at
all and your buckets will not sum to your total.
CURRENT_DATE() is UTC. Join
facilities.time_zone and use CURRENT_DATE(time_zone), or
every lease shifts a bucket once the UTC date rolls over ahead of the facility's.
is_active = 1 scopes this to current tenants, which
matches the Management Summary's Unpaid Charges (Current Tenants) block.
Moved-out tenants who still owe money are excluded — for a collections or
write-off view that includes them, and for aging by the age of each individual
charge, build from book_entries instead
(book = 'ACCOUNT_RECEIVABLE').
leases holds current state only. To trend delinquency you need to
snapshot this output on a schedule. It also refreshes hourly, so a payment taken in
the last few minutes will still show as owing; reconcile against the manager app
only after checking when the table last landed.
GREATEST(balance_ar, 0) matters. balance_ar goes negative
when a tenant is in credit, and summing raw values lets prepaid tenants silently
cancel out delinquent ones. Prepaid balances live in balance_prepaid if
you want them.
pct_on_autopay is the strongest lever here. Sites 10–15 points
below portfolio average on autopay adoption almost always carry proportionally more
ar_11_30. Note the IS TRUE —
is_autopay_enabled is nullable, and a bare COUNTIF counts
NULL as false.
needs_overlock and in_auction show whether policy is
actually being enforced. Heavy ar_over_360 with near-zero auction
activity is a process problem, not a collections problem.
How many increases went out, how big they were, and what they added to monthly revenue.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
DECLARE start_date DATE DEFAULT DATE '2025-01-01';
DECLARE end_date DATE DEFAULT CURRENT_DATE();
WITH changes AS (
SELECT
DATE_TRUNC(rc.rent_change_scheduled_date, MONTH) AS effective_month,
rc.rent_change_status,
rc.lease_rent_previous AS old_rent,
rc.rent_change_amount AS new_rent, -- NB: this is the new rent, not the delta
SAFE_DIVIDE(rc.rent_change_amount, rc.lease_rent_previous) - 1 AS pct_increase,
rc.street_rate,
rc.lease_id
FROM `cubby-partner-data.analytics.rate_changes` rc
WHERE rc.org_id = target_org
AND rc.rent_change_scheduled_date BETWEEN start_date AND end_date
AND rc.lease_rent_previous >= 10 -- guards against divide-by-near-zero junk
AND rc.rent_change_amount >= 10
),
outcomes AS (
SELECT c.*, l.lease_ended
FROM changes c
LEFT JOIN `cubby-partner-data.analytics.leases` l
ON l.org_id = target_org AND l.lease_id = c.lease_id
)
SELECT
effective_month,
COUNTIF(rent_change_status = 'APPLIED') AS increases_applied,
COUNTIF(rent_change_status = 'SCHEDULED') AS increases_scheduled,
COUNTIF(rent_change_status = 'CANCELLED') AS increases_cancelled,
ROUND(SAFE_DIVIDE(COUNTIF(rent_change_status = 'CANCELLED'), COUNT(*)) * 100, 1)
AS cancel_rate_pct,
ROUND(AVG(IF(rent_change_status = 'APPLIED', pct_increase, NULL)) * 100, 1)
AS avg_increase_pct,
ROUND(APPROX_QUANTILES(IF(rent_change_status = 'APPLIED', pct_increase, NULL), 2)[OFFSET(1)] * 100, 1)
AS median_increase_pct,
ROUND(SUM(IF(rent_change_status = 'APPLIED', new_rent - old_rent, 0)), 2)
AS monthly_revenue_added,
ROUND(AVG(IF(rent_change_status = 'APPLIED', SAFE_DIVIDE(new_rent, street_rate), NULL)) * 100, 1)
AS new_rent_vs_street_pct,
-- Descriptive only. See notes: this is NOT a causal churn estimate.
ROUND(SAFE_DIVIDE(
COUNTIF(rent_change_status = 'APPLIED' AND lease_ended IS NOT NULL
AND DATE_DIFF(lease_ended, effective_month, DAY) BETWEEN 0 AND 90),
NULLIF(COUNTIF(rent_change_status = 'APPLIED'), 0)) * 100, 1)
AS pct_moved_out_within_90d
FROM outcomes
GROUP BY effective_month
ORDER BY effective_month DESC;
rent_change_amount is the new rent, not the increase.
Reading it as a delta overstates your program by roughly an order of magnitude.
monthly_revenue_added above computes
new_rent - old_rent explicitly.
median_increase_pct, not
avg_increase_pct. The average is dragged around by a handful of
extreme records; one month tested at a 25.5% average against an 11.3% median. The
guards on lease_rent_previous and rent_change_amount remove
the worst divide-by-tiny artifacts, but the tail is still heavy.
pct_moved_out_within_90d is descriptive, not causal, and should
not be quoted as the churn cost of ECRI. There is no control group, and
tenants who receive increases are systematically different from those who do not
— they have already survived longer, which makes them lower-risk to begin with.
Comparing them against non-increased tenants biases the result. For a defensible
read, compare across increase size tiers among tenants who all received an
increase in the same month; that holds the selection effect roughly constant.
cancel_rate_pct is the operational health metric worth watching. A jump
usually means managers are pulling increases back after tenant pushback, which is a
leading indicator that next month's applied number will disappoint.
new_rent_vs_street_pct below 100% means even post-increase tenants sit
under the current asking rate — headroom for a larger increase next cycle.
Net cash collected, with refunds netted out and card decline rates alongside.
DECLARE target_org STRING DEFAULT 'org_XXXXXXXXXXX';
DECLARE start_date DATE DEFAULT DATE '2025-01-01';
DECLARE end_date DATE DEFAULT CURRENT_DATE();
SELECT
DATE_TRUNC(payment_date, MONTH) AS month,
facility_name,
ROUND(SUM(IF(payment_type = 'SALE' AND payment_status IN ('APPROVED','REFUNDED'),
payment_amount, 0)), 2) AS gross_collected,
ROUND(SUM(IF(payment_type = 'REFUND' AND payment_status = 'APPROVED',
payment_amount, 0)), 2) AS refunds,
ROUND(SUM(IF(payment_type = 'SALE' AND payment_status IN ('APPROVED','REFUNDED'),
payment_amount, 0))
- SUM(IF(payment_type = 'REFUND' AND payment_status = 'APPROVED',
payment_amount, 0)), 2) AS net_collected,
COUNTIF(payment_type = 'SALE' AND payment_status IN ('APPROVED','REFUNDED'))
AS successful_payments,
COUNTIF(payment_type = 'SALE' AND payment_status = 'DECLINED') AS declined_attempts,
ROUND(SAFE_DIVIDE(
COUNTIF(payment_type = 'SALE' AND payment_status = 'DECLINED'),
COUNTIF(payment_type = 'SALE' AND payment_status IN ('APPROVED','REFUNDED','DECLINED'))) * 100, 1)
AS decline_rate_pct,
ROUND(SAFE_DIVIDE(
SUM(IF(payment_type = 'SALE' AND payment_status IN ('APPROVED','REFUNDED')
AND payment_channel = 'AUTOPAY', payment_amount, 0)),
SUM(IF(payment_type = 'SALE' AND payment_status IN ('APPROVED','REFUNDED'),
payment_amount, 0))) * 100, 1)
AS pct_collected_via_autopay
FROM `cubby-partner-data.analytics.payments`
WHERE org_id = target_org
AND payment_date BETWEEN start_date AND end_date
GROUP BY month, facility_name
ORDER BY month DESC, net_collected DESC;
payment_amount values are positive, including refunds and
declines. A naive SUM(payment_amount) overstates revenue by
roughly 20% because it silently includes failed attempts. The status and type filters
above are not optional.
| payment_type | payment_status | Meaning |
|---|---|---|
SALE | APPROVED | Collected, still stands |
SALE | REFUNDED | Was collected, later refunded — the original row is restamped |
REFUND | APPROVED | The refund transaction itself, positive amount |
SALE | DECLINED / FAILED / ERROR | Never collected |
FAILURE | APPROVED | Failed-payment fee records — exclude from revenue |
APPROVED and REFUNDED sales, then
subtracts the REFUND rows. Because refunds carry their own
payment_date, a refund can land in a later month than its sale, so
monthly netting is approximate — the annual total is exact.
book_entries.
decline_rate_pct typically runs 13–25% by site, and a retry that
later succeeds appears as both a decline and a success — so this measures
attempt quality, not lost revenue. Rising declines alongside flat
pct_collected_via_autopay usually mean expiring cards;
leases.autopay_card_expiration is where to look next.
payments carries contact_id but no
lease_id, so you cannot attribute revenue to a specific unit
through this table. Go through book_entries for unit-level revenue.
| Table | Use it for |
|---|---|
book_entries | Accrual revenue, unit-level charge detail, GAAP-shaped reporting |
spaces_historical | Anything trended — occupancy, rate history, vacancy duration |
unit_turnover | Move-ins, move-outs, transfers; already transfer-aware |
calls, sms, emails, customer_touches | Contact-attempt volume and response times |
ga_events | Web sessions upstream of lead creation (date-partitioned) |
stor_track | Competitor rate benchmarking |
discounts, discount_programs | Promotional concession cost |
date_dim | Calendar joins — pre-built month, quarter, week, and weekday flags |
auctions, lease_auctions | Delinquency resolution outcomes |
date_dim is worth knowing about early: joining to it is cleaner than nesting
DATE_TRUNC and FORMAT_DATE calls, and it gives you gap-free
month rows even in periods with no activity.