Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MalcolmLeong
Frequent Visitor

How to build measure for % occupancy for hotel

Here's a sample of what I am looking at:

1. I have several hotels.  In this case, Hotel A and Hotel B.

2. In each hotel, I have (i) a daily breakdown, and (ii) the segment breakdown contributing to the sales

3. I have a fixed room inventory for each hotel : hotel A (300 rooms a day) and hotel B (100 rooms a day)

 

Problem :

1. I need to build a robust measure for occupancy, which is (Room Nights / Inventory). 

2. The measure will stand whether I remove the segment and/or remove the dates

 

Here's how it will look like.  I am trying to calculate the green colum Occupancy %.

1. The measure can be broken down by day/by segment/by hotel, etc

2. But I should also be able to aggregate it for e.g. if I removed the segment, Hotel A will be 77% on 1 Dec (i.e. (80+100+50)/300)), or even if I remove the dates, Hotel A will be 71% on 1Dec and 2Dec aggregated (i.e. (80+100+50+50+120+30) / (300+300).

 

 

 Sample data.png

 

Here is how my data table actually looks like and I'm having difficulties in building the measure that I need:

 

Data table.png

 

Any help will be much appreciated!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@MalcolmLeong,

In your table, create the following measure.

Occupancy% = SUM(Table[Room Nights])/MAX(Table[Inventory])

1.JPG2.JPG

For your last requirement that "even if I remove the dates, Hotel A will be 71% on 1Dec and 2Dec aggregated (i.e. (80+100+50+50+120+30) / (300+300)", please firstly create new table using DAX below.

NewTable = SUMMARIZE(Table,Table[Hotel],Table[Date],"room nights",SUM(Table[Room Nights]),"inventory",MAX(Table[Inventory]))


Then create the following measure in the new table.

percentage = DIVIDE(SUM('NewTable'[room nights]),CALCULATE(SUM('NewTable'[inventory]),FILTER('NewTable','NewTable'[Date]<=MAX('NewTable'[Date]))))

3.JPG

Regards,
Lydia

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@MalcolmLeong,

In your table, create the following measure.

Occupancy% = SUM(Table[Room Nights])/MAX(Table[Inventory])

1.JPG2.JPG

For your last requirement that "even if I remove the dates, Hotel A will be 71% on 1Dec and 2Dec aggregated (i.e. (80+100+50+50+120+30) / (300+300)", please firstly create new table using DAX below.

NewTable = SUMMARIZE(Table,Table[Hotel],Table[Date],"room nights",SUM(Table[Room Nights]),"inventory",MAX(Table[Inventory]))


Then create the following measure in the new table.

percentage = DIVIDE(SUM('NewTable'[room nights]),CALCULATE(SUM('NewTable'[inventory]),FILTER('NewTable','NewTable'[Date]<=MAX('NewTable'[Date]))))

3.JPG

Regards,
Lydia

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.