Forum Discussion
Llewbear
Advocate I
8 years agoTime Spent in each room
Good day, I have a similar to THIS POST, where I'm also trying to address with ALLEXCEPT(), however mine has a little twist. I'm trying to answer the following questions: 1 What room is ...
- 8 years ago
I assumed that travel time is only relevant if done the same day. If you remove the criteria of the same day, then it will work across days as well e.g. night 18/19 of May
Travel Time = VAR CurrentRoom = Motion[Room] VAR CurrentLocation = Motion[Location] VAR CurrentDate = Motion[Date] VAR CurrentTimeStamp = Motion[DateTime] VAR PreviousTimeStamp = CALCULATE ( MAX ( Motion[DateTime] ), ALL ( Motion ), Motion[DateTime] < CurrentTimeStamp ) VAR PreviousRoomTimeStamp = CALCULATE ( MAX ( Motion[DateTime] ), FILTER ( ALL ( Motion ), Motion[DateTime] = PreviousTimeStamp && Motion[Location] = CurrentLocation && Motion[Room] <> CurrentRoom ) ) RETURN IF ( PreviousRoomTimeStamp <> BLANK (), CurrentTimeStamp - PreviousRoomTimeStamp )
Stachu
Community Champion
8 years agomaybe I am oversimplyfying, but shouldn't Time Spent be just
Time Spent = SUM(Motion[Travel Time])
it excludes the travel time, and in case you want to add it you can just add the SUM(Motion[Travel Time 2])
Llewbear
Advocate I
8 years agoI managed to get it to work perfectly - thanks for the input!!