Forum Discussion

AndHan's avatar
AndHan
Frequent Visitor
5 years ago

Calculate occupancy at specific datetime

I'm working on a Power BI project, where I'm trying to visualize occupancy on a parkinglot vs time.

A parking bay can either be Occupied or Free and only have one state at any given time.

 

What I would like is to visualize is how many bays were occupied at a specific time (for example yesterday at 12 am or 3pm) on a graph.

I have a datetable with all the timestamps for my X-axis.

 

How can I calculate what state a bay had at any given time? 

When visualizing the occupancy the occupied + free bays should at all times equal the total amount of bays at the parking lot.

 

An example of my data is in the following format: 

bayIDstatus_startTimeendTimestatus
12020-10-13 05:37:27Z2020-10-13 12:02:42.6593146 +02:00Occupied
12020-10-13 10:02:40Z2020-10-13 12:02:58.5031439 +02:00Free
12020-10-13 10:02:56Z2020-10-13 12:04:03.1440793 +02:00Occupied
22020-10-13 10:04:00Z2020-10-13 12:04:23.4098165 +02:00Free
22020-10-13 10:04:22Z2020-10-13 15:04:40.0415468 +02:00Occupied
32020-10-13 13:04:31Z2020-10-13 18:40:10.8539946 +02:00Occupied
12020-10-13 16:40:08Z2020-10-13 18:45:58.7620901 +02:00Free
12020-10-13 16:45:57Z2020-10-13 18:49:01.7630668 +02:00Occupied

2 Replies

  • Hi AndHan ,

     

    Can you share your data example in table format please? You can find it here on the response window:

     This will make it much easier/quicker for people to grab your data and help you.

     

    Thanks,

     

    Pete

    • AndHan's avatar
      AndHan
      Frequent Visitor

      Sure - I have updated the post 🙂