Forum Discussion

Dfos25's avatar
Dfos25
New Member
4 years ago

Calculating Building Occupancy for multiple buildings based on last event by user

I am working with our facilites team to provide reports on our campus occupancy and to aid in contact tracing for illness.

 

I have one table showing:

EmpIDEventTimeLocationID
11/1/2022 12:00:00 PM1
11/1/2022 12:05:00 PM2
21/1/2022 12:10:00 PM1
21/1/2022 12:15:00 PM3
11/1/2022 12:30:00 PM1
31/1/2022 12:45:00 PM1
11/1/2022 1:30:00 PM3
21/1/2022 1:40:00 PM2

 

And one table showing:

LocationIDLocationName
1Bldg1
2Bldg2
3Bldg3

 

I need to generate a report showing the number of unique EmpID per BldgName based on their most recent EventTime. Ideally able to filter by date and EventTime grouped by hour. The intent being able to look at a building at any present or historical date and hour and see how many people were at each location  - either they had activity at the location during the hour or were left in there from previous hours. Lastly, anyone in a location for more than 12 hours needs to be removed from the count. I'm a little over my head with this one, so any help would be appreciated.

 

Expected Result:

DateEventTime(Hour)LocationNameDCountEmpID
1/1/20221200Bldg12
1/1/20221200Bldg20
1/1/20221200Bldg31
1/1/20221300Bldg11
1/1/20221300Bldg21
1/1/20221300Bldg31

 

 

1 Reply

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Community Support

    Hi Dfos25 ,

     

    Can you explain which 2 empID are the 1200,Bldg1?

    If possible, please share some example data containing all situations.

     

    Best Regards

    Community Support Team _ chenwu zhu