Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rustyfishbones
Master II

Create Intervals of every 15 minutes

Hi All,

I need to get this in a hurry.

I have a Calculated Dimension TIME(class(aggr(Time,Time),.25/24)) which gives me intervals of every 15 minutes

I want to create this in the Script, how can I do it

Regards

Alan

1 Solution

Accepted Solutions
hic
Former Employee

So, whats the rule? The four first digits denote hhmm ?

If so, you could use

Time(Floor(Time#(Left([Time-added],4),'hhmm'),1/24/4),'hh:mm')

I.e. first unpack the first four digits, then interpret them as hhmm, then round downwards to nearest quarter, then format as time again.

HIC

View solution in original post

12 Replies
swuehl
MVP

Have you tried:

Time( class( TIME, .25/24)) as TimeBucket

TIME being your time field

rustyfishbones
Master II
Author

Hi Swuehl,

I am getting all results as 00:00:00, do I need to format as Time hh:mm

Regards

Alan

sivarajs
Specialist II

Try this

Timestamp(floor(frac([Your field])*96)/96+floor([Your field]),'m/d/yyyy hh:mm TT') //96 rounds to 15 mins

Anonymous
Not applicable

Alan

Have look at Henric's blog post on this called The Master Time Table

Best Regards,     Bill

hic
Former Employee

If swuehl 's formula returns zero all the time (00:00:00), then your field TIME cannot be interpreted correctly... You probably need to interpret the field using Time#().

HIC

rustyfishbones
Master II
Author

Hi Henric

I am getting my Time field from the original [Time-added], and for this I have to reformat as below

So to get the TimeBucket Interval I require I tried what you see below (line2)

2013-11-15_1237.png

Am I even close to getting what I need?

rustyfishbones
Master II
Author

maybe I need to add the format in before the format out?

hic
Former Employee

I think you make it too complicated...

First of all, if you load [Time-added] as it is - no formatting, no anything - what do you get then? A string? Or a number? And what does the string look like?

Secondly, you use a formatting function Num() inside your Time#() function. This may destroy whatever information you might have in the field... Normally, you should have an interpretation function inside your formatting function, i.e. Time(Time#(...))

HIC

rustyfishbones
Master II
Author

Henric,

My [Time-added] lookslike this

2013-11-15_1339.png