How far ahead do guests book?

MediumAirbnbdate mathconditional counts· 20 XP

Airbnb's host team wants to tell hosts how far ahead guests usually book in their city, so they can set prices early enough.

For confirmed bookings, show per city the number of bookings, the average lead time (days from booked_at to checkin_date) and the percentage booked 30 or more days ahead.

Expected output

  • Both averages rounded to 1 decimal; any row order

Example of the shape (made-up values):

city bookings avg_lead_days pct_30_plus
Lisbon 280 31.4 49.6

Hints, the later steps and the answer come with Pro.

Write your query here. Ctrl + Enter submits.