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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Peter2
Frequent Visitor

Count rows between 2 dates

Hi, I have 3 tables, a Resident Location Table (Fact Table), which has columns for Person ID, Bed ID, Enter Date (the date a person takes up a bed) and an Exit Date (the date a person leaves the bed), a Location Table (Dimension Table) which has columns for Bed ID and Facility, and finally a Residents Table (Dimension Table) which has columnns for Person ID and other personal information.

 

What I am trying to do is determine how many people are in a Facility on a particular day, and have solved this by creating a new column in the Resident Location Date for that particular date i.e. all dates in this column are the same, and then creating another new column in the Resident Location Table that uses an IF statement to determine if the date is between the Enter Date and the Exit Date, to include the person in the Pivot, otherwise to exclude the person. A person can move from one facility to another and back depending on a variety of circumstances.

 

I am sure that this is an extremely cumbersome way of doing this calculation, and hopefully somebody can show me how to use a dax measure/s that will accomplish the above, so that I can use the Time Intelligence Functions to create some useful reports.

 

Thanks

 

Peter

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

You want Open Tickets: https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364#M147



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.