Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
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: 
Eaun
Contributor III
Contributor III

Calculate a range over an hour every hour

Hi

Would like to do a rolling sum over an hour every hour not sure how to do it can someone point me in the right direction please.

Have included an excel sheet to show what I mean.

Any help will be greatly appreciated 

1 Solution

Accepted Solutions
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi @Eaun 

I am not sure why your second hour has all the hours? The following will work in script (I called your time column 'timecolumn'):

Source:
LOAD
timecolumn,
good,
bad,
ugly
FROM [lib://Downloads/ahh more hours.xlsx]
(ooxml, embedded labels, table is Sheet1);

Summary:
LOAD
Hour(timecolumn) AS Hour,
Sum(good) AS TotalGood,
Sum(bad) AS TotalBad,
Sum(ugly) AS TotalUgly
RESIDENT Source
GROUP BY Hour(timecolumn);

If you just want it in the front end then make your dimension Hour(timecolumn) and then just have Sum(good), Sum(bad) and Sum(ugly) as measures.

Hope this helps.

Regards,

Mauritz

View solution in original post

2 Replies
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi @Eaun 

I am not sure why your second hour has all the hours? The following will work in script (I called your time column 'timecolumn'):

Source:
LOAD
timecolumn,
good,
bad,
ugly
FROM [lib://Downloads/ahh more hours.xlsx]
(ooxml, embedded labels, table is Sheet1);

Summary:
LOAD
Hour(timecolumn) AS Hour,
Sum(good) AS TotalGood,
Sum(bad) AS TotalBad,
Sum(ugly) AS TotalUgly
RESIDENT Source
GROUP BY Hour(timecolumn);

If you just want it in the front end then make your dimension Hour(timecolumn) and then just have Sum(good), Sum(bad) and Sum(ugly) as measures.

Hope this helps.

Regards,

Mauritz

Eaun
Contributor III
Contributor III
Author

Thank you Maurtiz that's what I was thinking but was not sure about it .