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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
apanta
Helper I
Helper I

Filters-DAX

Hi Everyone,
I will try to make my query short.
So, we have this table on the server which has got the details of the rooms in each facilities and has a column called 'inactive' (boolean) to let us know if the room is active or not. 

To know the occupancy rate, I am dividing the total occupied numbers by the total active rooms, and to calculate total active rooms I am using the below formula:


Active rooms =
COUNTAX(FILTER('Table_name', 'Table_name'[Inactive]=FALSE()),[Inactive])

It's working totally fine but my question is, as the number of active rooms changes occassionally, how do I capture the total active rooms that were active in each day?

For eg: if my total occupancy number is 100 today and active rooms are 110, then occupancy rate will be 90.9%, which is fine for today. But if I want to see the occupancy rate for yesterday, where occupied numbers were 100 but the active rooms were 108 (let's say 2 of the rooms were in renovation), here the occupancy rate should be 92.6%. But my formula is calculating the occupancy % = 100 divided by 110 instead of 100 divided by 108. It's taking the current active room numbers. How do I solve this? The active room numbers keep changing on the server and there's no date or anything to let us know how many rooms were active in a particular day.

Sorry for making it long but I'd really appreciate if anyone can help me to solve this.

Thank you!
2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @apanta ;

If you are calculating the number of active rooms per day, naturally you need a date column, so can you share what your data model looks like? What columns?  do you want the output to show?


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

I seems you can change your verbose measure to

Active rooms = COUNTROWS( FILTER( 'Table_name', NOT 'Table_name'[Inactive] ) )

From your description, it's inferred that 'Table_name' table is already filtered by date filter somewhere. Above all, DAX is not Excel worksheet formula; any discussion without date model is nothing but giberrish.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.