Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Grouping Timestamp

I have a question regarding timestamp.

How can i group the time into 1 hour slot?

I may have data at

9.01am

9.02am

.....

9.55am

10.00am

...

10.45am

11am

...

In this case, i would like to have a new column with the new timestamps

9am

10am

11am

thanks!

1 Solution

Accepted Solutions
Not applicable
Author

Thanks. I dont know why, but

Date(Date('9.11 PM', 'hh.mm tt'),'hh tt')

seems to work instead.  i have added this to my calculated dimension.

View solution in original post

9 Replies
sushil353
Master II
Master II

check out the interval match function and using mapping table for the solution.

kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

Try this one.

=Date(Date#('9.11 PM', 'hh.mm tt'),'hh tt')

Add your load script below mentioned syntex

Date(Date#(FieldName, 'hh.mm tt'),'hh tt')  as [New Time]

Not applicable
Author

Thanks. I dont know why, but

Date(Date('9.11 PM', 'hh.mm tt'),'hh tt')

seems to work instead.  i have added this to my calculated dimension.

Not applicable
Author

But now i have another question, does it just format?  I would like it to be a new field, so that when i chart, i can chart against this dimension.  May i know how to do that?

or do i have to add this expression to the load script?

kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

This syntex i posted for just example. you don't need that. use second one. you got a result

Not applicable
Author

try this this works fine according to your requirment.

hope this helps you.

time1:

LOAD  text(date(Date#(timefield,'hh.mmTT'),'hhTT')) as timenew,* INLINE [

    timefield

    9.01am

    9.02am

    9.03am

    9.55am

    10.00am

    10.45am

    11.00am

];

Not applicable
Author

after i have added to the load script, when i chart a table, i have something like this.

21/01/2012      09     sum(field)

21/01/2012      09     sum(field)

21/01/2012      09     sum(field)

21/01/2012      09     sum(field)

21/01/2012      10     sum(field)

21/01/2012      10     sum(field)

21/01/2012      11     sum(field)

why wont qlikview recognise the 1st 4 views as a same dimension? how can i get

21/01/2012      09     sum(field)

21/01/2012      10     sum(field)

21/01/2012      11     sum(field)

thanks!

Not applicable
Author

try this

Aggr(sum(field),numberfield)

here numberfield is the fieldname of your 2nd dimension.

Not applicable
Author

can i have dynamic time slots based on user preference?