Hello!, I’m trying to calculate the number of overlapping nights between reservation periods and a reporting period in my AppSheet app, but I’m running into issues because the relevant date fields are in different tables.
I have two tables in my app:
Reservations (registro_reservas):
Reports (reporte_economico):
I want to calculate the number of overlapping nights between a reservation and a report’s period. For example:
Scenario 1:
Scenario 2:
I tried this formula to calculate overlapping nights:
MAX(
0,
MIN([f_checkout], [hasta_reporte]) - MAX([f_checkin], [desde_reporte])
)
It works if all fields are in one table, but my reservation dates and report dates are in different tables. I need a solution that lets each report (with its own dates) calculate overlapping nights for its reservations.
How can I compute the overlapping nights for each reservation relative to a report’s period in AppSheet?
I'm doing this because i need to calculate the percentage of occupation of a few rental properties.!
Any advice or recommended approaches (e.g., using a join table or another method) would be greatly appreciated!
There is an INTERSECT() function. You can obtain the the two lists of Dates and use INTERSECT() to get the list that is common between them.
I hope this helps!
User | Count |
---|---|
15 | |
11 | |
10 | |
8 | |
3 |