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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Euto
Frequent Visitor

How to find the Sum of number days in month between two dates

Hello, I would need help in figuring out how to calculate occupancy rate given the following sample data.

- There's 1 City, and 4 Stores.

 

CityStoreStatusStartDateEndDate
Occupied January 10, 2020 August 15, 2020 
Occupied August 26, 2020 December 31, 2020 
Occupied January 1, 2020 May 3, 2020 
Occupied May 21, 2020 May 22, 2020 
Occupied May 23, 2020 August 9, 2020 
Occupied August 20, 2020 December 31, 2020 
Occupied January 1, 2020 August 25, 2020 
Occupied August 26, 2020 December 31, 2020 
Occupied January 1, 2020 May 9, 2020 
Occupied May 10, 2020 December 31, 2020 

 

See below what the desired result will be, the Occupancy Rate is what I desire to have.

 

Desired Result.png

 

 

This is only a sample data, in the actual dataset number or cities are over 100, each of those cities could have 4 - 144 stores each, and the period looked on is over 3 year period(2017, 2018, 2019, 2020).

- I would prefer not to go the route of listing the dates between start and end date in power query.


Additional Edit after initial post:
Sorry I made some changes to dates and changed the desired result to show some vacancy in Jan , May and Aug.

 

 

Thanks in advance.

1 REPLY 1
Greg_Deckler
Super User
Super User

@Euto - I'm going to mock this up but I am fairly certain this is a variation on the Overlap pattern I just posted to the Quick Measures Gallery recently. https://community.powerbi.com/t5/Quick-Measures-Gallery/Overlap/td-p/1372369


@ 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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors