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.
Hi Power BI Community,
I am looking to create a utilization tracker for rooms that I rent that shows all unutilized time even on days where there were no bookings.
I have three tables:
Additional Info: BookingsTable links to RoomsTable via room ID and BookingsTable links to CalendarTable via booking start date. BookingsTable and RoomsTable are connected with DirectQuery from a SQL database.
_______________________
Each room is open for 12 hrs (unless there’s an overtime request) so I used this measure to calculate the standard unutilized time per day:
Unutilized =
IF((12*COUNTA(RoomsTable[Room])*COUNTA(CalendarTable[Day]))-BookingsTable[Utilized]<0,
0, (12*COUNTA(RoomsTable[Room])*COUNTA(CalendarTable[Day]))-BookingsTable[Utilized])
This gives me the desired outcome IF the room has been booked every single day ([Utilized]>0) as shown below with Room 10 (including every day in February 2019):
But, this does not give me what I’m looking for with rooms that are not booked every day, as shown below with Room 20 (which was only booked for 7 days in February 2019):
I would like for Room 20 to have an entry for every day even if [Utilized] = 0. I think it would need to be in a measure or through a derived table since we are summing orders by day, but I have yet to crack it.
Any help would be greatly appreciated!
Thank you,
Alex
Solved! Go to Solution.
@aganes -
Two potential solutions:
1. A Measure can be converted from BLANK to 0 by adding 0, like this:
Unutilized = IF ( ( 12 * COUNTA ( RoomsTable[Room] ) * COUNTA ( CalendarTable[Day] ) ) - BookingsTable[Utilized] < 0, 0, ( 12 * COUNTA ( RoomsTable[Room] ) * COUNTA ( CalendarTable[Day] ) ) - BookingsTable[Utilized] ) + 0
2. In your table visual, you can select "Show items with no data".
Hope this helps,
Nathan
@aganes -
Two potential solutions:
1. A Measure can be converted from BLANK to 0 by adding 0, like this:
Unutilized = IF ( ( 12 * COUNTA ( RoomsTable[Room] ) * COUNTA ( CalendarTable[Day] ) ) - BookingsTable[Utilized] < 0, 0, ( 12 * COUNTA ( RoomsTable[Room] ) * COUNTA ( CalendarTable[Day] ) ) - BookingsTable[Utilized] ) + 0
2. In your table visual, you can select "Show items with no data".
Hope this helps,
Nathan
Thanks Nathan,
Your +0 measure worked in adding the missing days. I gave it a simple odification so days without rentals showed 12 hrs for Unutilized:
Unutilized 2 =
IF( BookingsTable[Utilized] = 0, 12,
IF ( ( 12 * COUNTA ( RoomsTable[Room] ) * COUNTA ( CalendarTable[Day] ) ) - BookingsTable[Utilized] < 0, 0, ( 12 * COUNTA ( RoomsTable[Room] ) * COUNTA ( CalendarTable[Day] ) ) - BookingsTable[Utilized] )) + 0
Thank you for the help,
Alex
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
80 | |
63 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |