Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dafnis14
Specialist
Specialist

Reference DateTime for calculating occupancy

Hi All,

I would like to analyze occupancy percent  of a parking lot .

My data include entrance and exit timestamps of cars.

I generated reference timestamps for each hour in the range.

My question is which is the best time resolution (i.e., hour, half an hour..) to analyze the occupancy?

This is due to the fact that the entry and exit times can vary, and I'm not sure how should I round them.

Please consider such cases:

Receipt_EntryDateTime

Receipt_ExitDateTime

04/03/2016 11:35:00

04/03/2016 12:33:00

Receipt_EntryDateTime

Receipt_ExitDateTime

06/04/2016 11:43:00

06/04/2016 12:27:00

Thanks!

13 Replies
sfatoux72
Partner - Specialist
Partner - Specialist

Hi Marco,

I found just a little problem, but I found the solution too 😉

The problem

If you consider only one receiptKey (that start en end in the same day) with a BinSize 00:15 like that, the first bar is not correct :

Community_1205340_2.png

Community_1205340_3.png

Community_1205340_4.png

The reason

It is due to the expression of the calculated dimension :

      =Time(Floor(Time,vBinSize),'hh:mm')

The value used as a step by the floor function is not a finite value (00:15 ==> 0.010416666666666666666 ...), but since it is the finite value 0.010416666666667 that is actually used, there is in the end A slight offset that causes the problem found.

The solution

We need to work with minute in this expression :

     =Time(Floor(Hour(Time)*60+Minute(Time), Hour(vBinSize)*60+Minute(vBinSize))/24/60,'hh:mm')

Like that the step is a finite value 15  and we have a correct result :

Community_1205340_5.png

MarcoWedel

Hi,

yes, due to the limited resolution of the underlying numerical values, time arithmetics may show this behaviour.

Another solution might be:

=Time(Floor(Time,Time#(Time(vBinSize,'hh:mm'),'hh:mm')),'hh:mm')

QlikCommunity_Thread_248464_Pic6.JPG

See also:

Rounding Errors

Correct Time Arithmetic | Qlikview Cookbook

hope this helps

regards

Marco

dafnis14
Specialist
Specialist
Author

Thank you!

MarcoWedel

You're welcome

Regards

Marco