Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello. I’m looking for some assistance to find a way to calculate utilization (%) by day and hour that can show in a matrix table. 🙂 The total number of rooms available may be needed to calculate the utilization.
Sample Data Set:
Room | Meeting Day | Start Time | End Time |
CA0008 | W | 11:00 AM | 12:15 PM |
CA0008 | TR | 9:35 AM | 10:50 AM |
CA0008 | TR | 11:00 AM | 12:15 PM |
CA0008 | T | 3:00 PM | 4:50 PM |
CA0008 | R | 4:15 PM | 5:30 PM |
CA0008 | MW | 3:00 PM | 4:15 PM |
CB0115 | TR | 11:00 AM | 12:15 PM |
CB0115 | TR | 1:00 PM | 2:15 PM |
CB0115 | R | 3:00 PM | 5:50 PM |
CB0220 | TR | 10:00 AM | 10:50 AM |
CB0220 | TR | 4:00 PM | 5:30 PM |
CB0220 | TR | 4:00 PM | 5:30 PM |
CB0220 | MWF | 8:00 AM | 8:50 AM |
CC0030 | TR | 1:00 PM | 2:50 PM |
CC0030 | MW | 11:00 AM | 12:50 PM |
CC0132 | T | 2:00 PM | 4:50 PM |
CD0133 | TR | 2:00 PM | 3:15 PM |
CD0133 | MW | 2:00 PM | 3:15 PM |
CD0133 | M | 9:00 AM | 11:50 AM |
Sample Matrix Table:
Day/Time | 8 AM | 9 AM | 10 AM | 11 AM | 12 PM | 1 PM | 2 PM | 3 PM | 4 PM |
M |
|
|
|
|
|
|
|
|
|
T |
|
|
|
|
|
|
|
|
|
W |
|
|
|
|
|
|
|
|
|
T |
|
|
|
|
|
|
|
|
|
F |
|
|
|
|
|
|
|
|
|
Appreciate any guidance and assistance!
Gig
Solved! Go to Solution.
Hi, @tsupani
According to your expected result, I think what can be achieved in Power BI is the data part, this is the result I can achieve:
What’s more, I don’t think the detailed data(room number and time period) can also be displayed in Power BI Matrix, I suggest you to accept this reply as a solution and open a new case to ask this question so that more exports can research whether this can be achieved in Power BI.
This is my test pbix file according to your expected result(My steps is similar to the steps I mentioned before):
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @tsupani
According to your expected result, I think what can be achieved in Power BI is the data part, this is the result I can achieve:
What’s more, I don’t think the detailed data(room number and time period) can also be displayed in Power BI Matrix, I suggest you to accept this reply as a solution and open a new case to ask this question so that more exports can research whether this can be achieved in Power BI.
This is my test pbix file according to your expected result(My steps is similar to the steps I mentioned before):
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @tsupani
According to your description, I can understand your requirement clearly, and you can follow my steps and find out if it’s exactly what you want:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hZJNDoMgEIWvYli7eMNIYtlpm+5IjGniwnj/axSo4KA2LGZCwsd788O6qucAoFetWnwQWaAZXDhqS6aZnNpaAX1mnx6WzQ7BmshfobqUDw7MFJguCJ2ROV783rbKWL4ibjnJCKcRRKZaT0llpVtmLsyMrHmE1sgyOMyKERVUJ5T4j1KFccvb5z679dLsCTDuOhNlJ8Zd119QxHrfmb7f2csjnMwOhuUYExPNakz8aLkcSo1tXw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Room = _t, #"Meeting Day" = _t, #"Start Time" = _t, #"End Time" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Time", type time}, {"End Time", type time}}),
#"Split Column by Position" = Table.SplitColumn(#"Changed Type", "Meeting Day", Splitter.SplitTextByRepeatedLengths(1), {"Meeting Day.1", "Meeting Day.2", "Meeting Day.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"Room", type text}, {"Meeting Day.1", type text}, {"Meeting Day.2", type text}, {"Meeting Day.3", type text}}),
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type1", {"Meeting Day.1", "Meeting Day.2", "Meeting Day.3"}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Only Selected Columns",{"Attribute"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value", "Meeting Day"}}),
#"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns",{"Room", "Meeting Day", "Start Time", "End Time"})
in
#"Reordered Columns"
Time =
var _hour=GENERATESERIES(8,16,1)
return SELECTCOLUMNS(_hour,"Start Time",TIME([Value],1,0),"End Time",TIME([Value]+1,0,0),"Time period",TIME([Value],1,0)&" - "&TIME([Value]+1,0,0))
utilization =
var _allrooms=
CALCULATE(DISTINCTCOUNT('Table'[Room]),ALL('Table'))
var _usedrooms=
CALCULATE(
COUNT('Table'[Room]),
FILTER(ALLSELECTED('Table'),
[Start Time]<=MAX('Time'[Start Time])&&[End Time]>=MAX('Time'[End Time])&&[Meeting Day]=MAX('Table'[Meeting Day])))
var _utilization=
DIVIDE(_usedrooms,_allrooms)
return
IF(_utilization=BLANK(),0,_utilization)
And you can get what you want.
You can download my test pbix file here
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @v-robertq-msft. I appreciate your help. I still can't get the right matrix table as most classes are scheduled in different patterns (TR, MWF, MW, etc.). For the matrix table, I expect to see the scheduling pattern by day (M, T, W, R, and F) at each hour slot.
Let me further clarify this in a little more detail.
Sample Data:
CA0008, 8:00 AM - 8:50 AM, MWF
CB0220, 8:00 AM - 8:50 AM, MW
CC0030, 8:00 AM - 8:50 AM, MW
CA0008, 8:00 AM- 8:50 AM, TR
CB0220, 8:00 AM - 8:50 AM, T
Utilization = (Total Number of Rooms Occupied/Total Number of Rooms Available)*100
Note: Total Number of Rooms Available - 10
Expected Matrix Table:
Thanks so much for your time and help!
Gig
Hi, @tsupani
Time =
var _hour=GENERATESERIES(8,16,1)
return SELECTCOLUMNS(_hour,"Time",TIME([Value],0,0))
utilization =
var _allrooms=
CALCULATE(DISTINCTCOUNT('Table'[Room]),ALL('Table'))
var _usedrooms=
CALCULATE(
COUNT('Table'[Room]),
FILTER(ALLSELECTED('Table'),
[Start Time]<=MAX('Time'[Time])&&[End Time]>=MAX('Time'[Time])&&[Meeting Day]=MAX('Table'[Meeting Day])))
var _utilization=
DIVIDE(_usedrooms,_allrooms)
return
IF(_utilization=BLANK(),0,_utilization)
And you can get what you want.
You can download my test pbix file here
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for taking the time to find out the solution. 🙂
Sorry I wasn't clear about my communication on the first post. Your proposed solution seems to move in the right direction but still doesn't meet certain requirements. In particular, I hope to see the utilization by day (including M, T, W, R, and F) instead of the meeting day patterns (e.g., M, MW, MWF, etc.) and by the hour from 8 AM - 4 PM (e.g., 8:01 am - 9:00 am, 9:01 am - 10:00 am, etc.).
@tsupani , first of all you need an hourly bucket . See if time table or a merge with time table can help
https://kohera.be/blog/power-bi/how-to-create-a-time-table-in-power-bi-in-a-few-simple-steps/
then this measure should work
divide(distinctcount(Table[Room]), calculate(distinctcount(Table[Room]), allselected(Table)))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
122 | |
80 | |
47 | |
44 | |
35 |
User | Count |
---|---|
182 | |
83 | |
70 | |
47 | |
45 |