Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Merge Timestamps into Hours

Hi!

My question is if i could sum timestamps into hours.

I've a file with statistics that has date and timestamp ie.

2012-05-01 17:01 3

2012-05-01 17:04 7

2012-05-01 17:15 2

2012-05-01 17:44 1

(3, 7 , 2, 1 is number of articles sold)

I would like to sum every line into hours.

so the above rows would be:  2012-05-01 18.00 13

Is this possible?

//BR
Patrik

Labels (1)
1 Solution

Accepted Solutions
Jason_Michaelides
Partner - Master II
Partner - Master II

I would probably create a new field in the script:

LOAD

     *,

     Date(Floor(Timestamp)+(Hour(Timestamp)*(1/24)),'YYYY-MM-DD hh:mm')     AS     DateHour

FROM.....;

Then, in your chart just use DateHour as the dimension as Sum(Stats) as the expression.

Hope this helps,

Jason

View solution in original post

2 Replies
Jason_Michaelides
Partner - Master II
Partner - Master II

I would probably create a new field in the script:

LOAD

     *,

     Date(Floor(Timestamp)+(Hour(Timestamp)*(1/24)),'YYYY-MM-DD hh:mm')     AS     DateHour

FROM.....;

Then, in your chart just use DateHour as the dimension as Sum(Stats) as the expression.

Hope this helps,

Jason

Not applicable
Author

Hi,

Create a new field at script level with

Subfield(Subfield(TimestampField,' ',2),':',1)

Above expression will give you 17 in all timestamp value where hour value is 17. Now u can add up your articles using this field.

Regards

Ankur