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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Super User
Super User

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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.