qobrix_days_on_market
Calculate days-on-market analytics for sold or reserved properties, with count, mean, median, percentile aggregations, and breakdowns by property type, city, or agent.
Instructions
Days-on-market analytics. Joins Contracts to Properties on property_id and computes the (close_date - listing_date) duration in days, then aggregates count / mean / median / p75 / p90 / min / max. Defaults: kind='sold' (cos + agreed), listing_date_field='listing_date' with per-row fallback to website_listing_date then created. Use group_by to break down by property_type, city, agent, or commission_to_2 (broker). Set include_outliers=true for the 5 longest and 5 shortest deals. Example uses: Overall DOM for 2026 sales: { kind: 'sold', year: 2026 }. DOM by property type: { kind: 'sold', year: 2026, group_by: 'property_type' }. DOM by city (with outliers): { year: 2026, group_by: 'city', include_outliers: true }. Reservation cycle: { kind: 'reserved', year: 2026 }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ISO exclusive upper bound. | |
| top | No | Max group buckets to return (default 10). | |
| from | No | ISO inclusive lower bound. | |
| kind | No | Which contracts count as a 'close' (default 'sold' = contract_type=cos + contract_status=agreed). 'reserved' = contract_status=reserved. 'any_closed' = reserved + agreed. | |
| year | No | Calendar year window. | |
| group_by | No | Optional grouping field(s) on the property side: 'property_type', 'city', 'commission_to_2'/'agent' (broker). Multi-dim arrays of 2-3 fields supported. | |
| since_days | No | Rolling window in days. | |
| close_date_field | No | Anchor on the contract side. Default depends on kind: sold→date_of_contract, reserved→date_of_reservation. | |
| include_outliers | No | When true, also returns the 5 longest-DOM and 5 shortest-DOM deals. | |
| listing_date_field | No | Anchor on the property side (default 'listing_date'). Per-row fallback to website_listing_date then created when the chosen field is null. |