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
jbenedict2
Frequent Visitor

Space Utilization Based on Date Range and Days of Week

Hello.  I am trying to calculate the space utilization rate for classrooms on a daily basis.  Space utilization rate is defined as (Hours Used/Hours Available)x100.  I've been able to figure out how to calculate the Hours per Session (which I plan to then sum by day to get Hours Used), but where I'm stuck is mapping out those Hours per Session to the specific dates that the class takes place.  I've gotten as far as using a GENERATE statement using my Meeting Info table and my Date table to get the dates between the start and end dates of the class, but I can't figure out how to get only those dates that reflect the days of the week when the class takes place.

 

Here's my data structure:

 

Meeting Info table that has the following columns:

  • CRN (5 character string that serves as a class section identifier) [note that there can be multiple rows per CRN due to multiple meeting patterns]
  • Start Time
  • End Time
  • Start Date
  • End Date
  • Days (shows days of week that class takes place ex. TR for Tuesday and Thursday)
  • Location (the room where the class takes place)
  • Hours Per Session (calculated column)

Date table that has the following columns:

  • Calendar Date
  • Day Name
  • Day Abbreviated (M = Monday, T = Tuesday, etc. so that the days are the same as those used in Days column of Meeting Info)
  • More standard Date table columns (Calendar Month Name, Quarter, etc.)

 

The GENERATE statement that I've been trying to work with (although I'm open to getting rid of it if necessary) is:

DatesBetweenStartAndEnd =

GENERATE (
    'Meeting Info',
    FILTER ('Date',
        'Date'[Calendar Date] >= EARLIER ( 'Meeting Info'[Start Date] )
            && 'Date'[Calendar Date] <= EARLIER ( 'Meeting Info'[End Date] )))

 

Would anyone be able to help with either modifying the GENERATE statement to pull only dates that match up with days of the week when a class takes place or with a new method of being able to calculate space utilization rate by day?  Thanks in advance!

1 ACCEPTED SOLUTION

Hi @jbenedict2,

 

See my solution here.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

13 REPLIES 13
Ashish_Mathur
Super User
Super User

Hi,

 

Share the dataset and also show the exact result that you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello,

 

Here is a link to a mock-up of my dataset with the desired result explained:

Mock Up for Utilization Rate Help

 

Note that the data source type is not the same as in my actual file; I've used Excel to replicate the structure and contents since I cannot share a file with connections to our college systems.

 

Please let me know if there are any issues opening the file - this is my first time trying to share one on the forum 🙂

 

Thanks,

Jess

 

 

Hi,

 

If i look at the first row of your meeting info table, does it mean that for CRN 75119, the class will be help on all Thursdays between the date range March 1, 2018 and May 24, 2018 for 2 hours?  In that case, the total hours used would be

 

Number of Thursdays between that date range * 2

 

Is my understanding correct?  Also, how will one compute the total hours available?

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

Yes, that is correct for CRN 75119, and for the total hours used.

 

The total hours available will actually be a static number (12 hours).

 

Thanks,

Jess

Hi @jbenedict2,

 

Share the data in an Excel file format.  I need to apply a transformation on the underlying data.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello,

 

Here's the data file in Excel format: Excel File for Mock Up

 

Thanks!

Hi @jbenedict2,

 

I do not see an option to download the workbook from there.   I can just see the data there but there is no download option.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

If you hover over the file three dots should appear to the right of the title; when you click the dots there should be an option to download the file.

 

Let me know if that doesn't work and I'll try moving the file to something like DropBox.

 

Thanks,

Jess

Hi,

 

There is no download option when i click on the 3 dots.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

Ok, let's try DropBox!  Here we go:

 

DropBox Link

 

Thanks,

Jess

Hi @jbenedict2,

 

See my solution here.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

This is perfect!  I was able to adapt it a bit so that it works in Power BI (just a matter of adjusting the syntax some).

 

Thank you for all of your help!

 

Jess

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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