Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I wanted to get the total count of calls made by the REST API, in a particular time frame. Eg:
Say I am doing 2 REST API Calls at 12:40:00 & 12:56:00 and 4 Rest API calls between 3pm-4pm, I need to get the below:
Time Frame | Count |
12pm-1pm | 2 |
1pm-2pm | 0 |
2pm-3pm | 0 |
3pm-4pm | 4 |
The built in function to split into buckets is Class().
Class(CallTimestamp, Interval#(1,'h'))
Sometimes people write the width argument as "1/24" instead of "Interval#(1,'h')". I think "Interval#()" is more correct. You can also use "MakeTime(1)".
However Class() won't give the string formatting you asked for so I would write it as:
Time(Floor(CallTimestamp, Interval#(1,'h')), 'htt')
& '-'
& Time(Ceil(CallTimestamp+.000001, Interval#(1,'h')), 'htt')
Meaning round down to hour with Floor and round up to next hour with Ceil. The +.000001 is necessary to handle the case where CallTimestamp is exactly on the hour.
-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com
Try this modify according to your time frame
=if(hour(CallTimestamp) >= 12 and hour(CallTimestamp) < 13, '12pm-1pm',
if(hour(CallTimestamp) >= 13 and hour(CallTimestamp) < 14, '1pm-2pm',
if(hour(CallTimestamp) >= 14 and hour(CallTimestamp) < 15, '2pm-3pm',
if(hour(CallTimestamp) >= 15 and hour(CallTimestamp) < 16, '3pm-4pm', 'Other')
)))
We don't have any built-in functions to split for 24 hours?
The built in function to split into buckets is Class().
Class(CallTimestamp, Interval#(1,'h'))
Sometimes people write the width argument as "1/24" instead of "Interval#(1,'h')". I think "Interval#()" is more correct. You can also use "MakeTime(1)".
However Class() won't give the string formatting you asked for so I would write it as:
Time(Floor(CallTimestamp, Interval#(1,'h')), 'htt')
& '-'
& Time(Ceil(CallTimestamp+.000001, Interval#(1,'h')), 'htt')
Meaning round down to hour with Floor and round up to next hour with Ceil. The +.000001 is necessary to handle the case where CallTimestamp is exactly on the hour.
-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com
Thank you let me try and post the results here.
This worked! thanks a lot @rwunderlich.