Forum Discussion
Improve speed in occupancy calculation
- 11 months ago
Hi Anonymous,
You can create a separate calendar table that lists every hour in the period you want to analyze. This table is much smaller than expanding all hospitalizations into hourly rows. Then, for each hour in the calendar, you look up and match only the hospitalizations where the patient was actually present during that hour, that is, where the hospitalization start time is before or equal to the hour and the end time is after it. This avoids unnecessary expansion and keeps the dataset manageable. Once you have matched the hospitalizations to each hour, you can expand and group the data by hour and department, counting how many hospitalizations overlap each hour to calculate occupancy. This method is flexible, allowing you to adjust the time period and increment (like hourly or half hourly), and it dramatically reduces the number of rows and memory load compared to expanding every hospitalization for its full duration. Filtering the calendar to the exact range needed and using techniques like buffering can further improve performance.
Please refer to below similar thread solved in community and let me know if this helps?
Solved: Calculating hourly occupancy of a medical clinic (... - Microsoft Fabric Community
Thanks,
prashanth
MS fabric community support
Hi Anonymous,
We would like to confirm if our community members answer resolves your query or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are happy to help you.
rohit1991, thanks for your prompt response
Thank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
Thanks for the replies rohit1991 and v-prasare , still looking for a solution tough.
The occupancy needs to be calculated per hour, so aggregating for date or month doesn't work, and I am not able to edit the source file, unfortunately.
- v-prasare1 year agoCommunity Support
Thanks for confirmation, we will try look into it and post here if got working solution for you