Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |