Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
I have two tables: a Date Table and a Stays Table
The stays table has the guest, the room, and the check-in date, and the check-out date. From a previous post, I had help getting the guests per night across date ranges, but now I'm struggling to get the service dates to calculate the average occupancy per day and per bed. I couldn't use the same filter logic to bring in all the unique dates between the checkin and checkout dates.
If no one stays in a building, I want to be able to exclude that date from that building's occupancy (we only want to measure occupany when that building is in-use)
Stays Table
| GuestID | Building | Bed ID | Check-In Date | Checkout Date |
| 1 | 1 | 100 | 01/01/2026 | 01/08/2026 |
| 2 | 2 | 102 | 01/01/2026 | 01/05/2026 |
| 3 | 1 | 104 | 12/31/2025 | 01/10/2026 |
| 4 | 1 | 106 | 01/02/2026 | 01/03/2026 |
| 5 | 2 | 100 | 1/08/2026 | 01/10/2025 |
Date Table (spans >365 days)
| Date |
| 01/01/2026 |
| Etc. |
Output Wanted
| Building | Average Daily Occupancy |
| Building 1 | 1.6 (to round up to 2) |
| Building 2 | 1 |
previous post re: daily occupancy
Solved! Go to Solution.
This counts how many beds are occupied on a given date.
Daily Occupancy =
VAR CurrentDate = SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( Stays[Bed ID] ),
FILTER (
Stays,
Stays[Check-In Date] <= CurrentDate
&& Stays[Checkout Date] > CurrentDate
)
)If you put Date + Building in a table, this will show the correct nightly occupancy.
Now we average only over dates where occupancy > 0 for that building.
Average Daily Occupancy :=
VAR OccupiedDates =
FILTER (
VALUES ( 'Date'[Date] ),
[Daily Occupancy] > 0
)
RETURN
AVERAGEX (
OccupiedDates,
[Daily Occupancy]
)
This counts how many beds are occupied on a given date.
Daily Occupancy =
VAR CurrentDate = SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( Stays[Bed ID] ),
FILTER (
Stays,
Stays[Check-In Date] <= CurrentDate
&& Stays[Checkout Date] > CurrentDate
)
)If you put Date + Building in a table, this will show the correct nightly occupancy.
Now we average only over dates where occupancy > 0 for that building.
Average Daily Occupancy :=
VAR OccupiedDates =
FILTER (
VALUES ( 'Date'[Date] ),
[Daily Occupancy] > 0
)
RETURN
AVERAGEX (
OccupiedDates,
[Daily Occupancy]
)
thank you! this was exactly what I needed!
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 53 | |
| 48 | |
| 38 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 93 | |
| 79 | |
| 37 | |
| 27 | |
| 25 |